Fix: revise php filename
This commit is contained in:
@@ -129,7 +129,7 @@ DBService.prototype.requestWritingInfo = function(writingID, onSucceededListener
|
|||||||
// typing exam
|
// typing exam
|
||||||
DBService.prototype.addPrevHourTypingExamRecord = function(writingID, record, onSucceededListener, onFailedListener) {
|
DBService.prototype.addPrevHourTypingExamRecord = function(writingID, record, onSucceededListener, onFailedListener) {
|
||||||
var xhr = this.makeXhr(
|
var xhr = this.makeXhr(
|
||||||
"php/writing/update_result_record.php",
|
"php/record/update_writing_record.php",
|
||||||
(function() { // onreadystatechange
|
(function() { // onreadystatechange
|
||||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||||
var replyJSON = JSON.parse(xhr.responseText);
|
var replyJSON = JSON.parse(xhr.responseText);
|
||||||
@@ -152,7 +152,7 @@ DBService.prototype.addPrevHourTypingExamRecord = function(writingID, record, on
|
|||||||
|
|
||||||
DBService.prototype.updateTypingExamRecord = function(writingID, record, onSucceededListener, onFailedListener) {
|
DBService.prototype.updateTypingExamRecord = function(writingID, record, onSucceededListener, onFailedListener) {
|
||||||
var xhr = this.makeXhr(
|
var xhr = this.makeXhr(
|
||||||
"php/writing/update_result_record.php",
|
"php/record/update_writing_record.php",
|
||||||
(function() { // onreadystatechange
|
(function() { // onreadystatechange
|
||||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||||
var replyJSON = JSON.parse(xhr.responseText);
|
var replyJSON = JSON.parse(xhr.responseText);
|
||||||
@@ -174,7 +174,7 @@ DBService.prototype.updateTypingExamRecord = function(writingID, record, onSucce
|
|||||||
|
|
||||||
DBService.prototype.getTypingExamHighestRecord = function(writingID, onSucceededListener, onFailedListener) {
|
DBService.prototype.getTypingExamHighestRecord = function(writingID, onSucceededListener, onFailedListener) {
|
||||||
var xhr = this.makeXhr(
|
var xhr = this.makeXhr(
|
||||||
"php/writing/get_highest_record.php",
|
"php/record/get_writing_highest_record.php",
|
||||||
(function() { // onreadystatechange
|
(function() { // onreadystatechange
|
||||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||||
var replyJSON = JSON.parse(xhr.responseText);
|
var replyJSON = JSON.parse(xhr.responseText);
|
||||||
@@ -192,3 +192,91 @@ DBService.prototype.getTypingExamHighestRecord = function(writingID, onSucceeded
|
|||||||
+ "&writingID=" + writingID
|
+ "&writingID=" + writingID
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DBService.prototype.requestWritingPlayerHistory = function(writingID, date, onSucceededListener, onFailedListener) {
|
||||||
|
var historyRecordManager = new HistoryRecordManager();
|
||||||
|
|
||||||
|
if(isDebugMode()) {
|
||||||
|
this.loadTempPlayerHistory(historyRecordManager);
|
||||||
|
|
||||||
|
if(onSucceededListener !== null)
|
||||||
|
onSucceededListener(historyRecordManager);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
var xhr = this.makeXhr(
|
||||||
|
"php/record/history_record.php",
|
||||||
|
(function() { // onreadystatechange
|
||||||
|
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||||
|
var replyJSON = JSON.parse(xhr.responseText);
|
||||||
|
|
||||||
|
if(replyJSON != null)
|
||||||
|
onSucceededListener(this.parseJSONtoHistoryRecord(replyJSON));
|
||||||
|
else
|
||||||
|
onFailedListener(replyJSON);
|
||||||
|
}
|
||||||
|
}).bind(this)
|
||||||
|
);
|
||||||
|
xhr.send(
|
||||||
|
"maestroID=" + this.maestroID
|
||||||
|
+ "&playerID=" + this.playerID
|
||||||
|
+ "&writingID=" + writingID
|
||||||
|
+ "&date=" + date
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
DBService.prototype.parseJSONtoHistoryRecord = function(json) {
|
||||||
|
var historyRecordManager = new HistoryRecordManager();
|
||||||
|
|
||||||
|
if(typeof json === "undefined")
|
||||||
|
return historyRecordManager;
|
||||||
|
|
||||||
|
if(typeof json.history === "undefined")
|
||||||
|
return historyRecordManager;
|
||||||
|
|
||||||
|
var count = json.history.length;
|
||||||
|
for(var i = 0; i < count; i++) {
|
||||||
|
var record = new HistoryRecord(
|
||||||
|
json.history[i]["Date"],
|
||||||
|
json.history[i]["AppName"],
|
||||||
|
json.history[i]["HighScore"]
|
||||||
|
);
|
||||||
|
historyRecordManager.push(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
return historyRecordManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DBService.prototype.loadTempPlayerHistory = function(historyRecordManager) {
|
||||||
|
// historyRecordManager.push(new HistoryRecord("05/14", "space_invaders", 14460));
|
||||||
|
historyRecordManager.push(new HistoryRecord("2019-05-13 00:00:00", "space_invaders", 14460));
|
||||||
|
historyRecordManager.push(new HistoryRecord("2019-05-12 00:00:00", "space_invaders", 12860));
|
||||||
|
historyRecordManager.push(new HistoryRecord("2019-05-11 00:00:00", "typing_english_basic", 15460));
|
||||||
|
historyRecordManager.push(new HistoryRecord("2019-05-10 00:00:00", "typing_korean_basic", 13040));
|
||||||
|
historyRecordManager.push(new HistoryRecord("2019-05-09 00:00:00", "space_invaders", 15460));
|
||||||
|
historyRecordManager.push(new HistoryRecord("2019-05-08 00:00:00", "typing_english_basic", 14607));
|
||||||
|
historyRecordManager.push(new HistoryRecord("2019-05-07 00:00:00", "typing_korean_basic", 13058));
|
||||||
|
}
|
||||||
|
|
||||||
|
DBService.prototype.loadTempRanking = function(rankingRecordManager) {
|
||||||
|
rankingRecordManager.push(new RankingRecord(1, 7, "강경모", 4400));
|
||||||
|
rankingRecordManager.push(new RankingRecord(2, 2, "강성태", 3400));
|
||||||
|
rankingRecordManager.push(new RankingRecord(3, 3, "김기덕", 2400));
|
||||||
|
rankingRecordManager.push(new RankingRecord(4, 4, "김남희", 1400));
|
||||||
|
rankingRecordManager.push(new RankingRecord(5, 5, "고봉순", 900));
|
||||||
|
rankingRecordManager.push(new RankingRecord(6, 6, "파르마", 800));
|
||||||
|
rankingRecordManager.push(new RankingRecord(7, 1, "박지상", 700));
|
||||||
|
rankingRecordManager.push(new RankingRecord(8, 8, "신현주", 600));
|
||||||
|
rankingRecordManager.push(new RankingRecord(9, 9, "꼬봉이", 500));
|
||||||
|
rankingRecordManager.push(new RankingRecord(10, 10, "거북이", 400));
|
||||||
|
rankingRecordManager.push(new RankingRecord(11, 11, "다람쥐", 300));
|
||||||
|
rankingRecordManager.push(new RankingRecord(12, 12, "사시미", 200));
|
||||||
|
rankingRecordManager.push(new RankingRecord(13, 13, "태권도", 100));
|
||||||
|
rankingRecordManager.push(new RankingRecord(14, 14, "합기도", 40));
|
||||||
|
rankingRecordManager.push(new RankingRecord(15, 15, "우습지", 10));
|
||||||
|
rankingRecordManager.push(new RankingRecord(16, 16, "하하하", 4));
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,39 +11,66 @@ function HistoryBoard(dataType) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.date = null;
|
||||||
this.todayBestRecord = 0;
|
this.todayBestRecord = 0;
|
||||||
|
|
||||||
this.dbConnectManager = new DBConnectManager();
|
this.dbConnectManager = new DBConnectManager();
|
||||||
|
|
||||||
|
this.dbService = new DBService();
|
||||||
|
this.dbService.setMaestroID(sessionStorageManager.getMaestroID());
|
||||||
|
this.dbService.setPlayerID(sessionStorageManager.getPlayerID());
|
||||||
|
|
||||||
setTimeout(
|
setTimeout(
|
||||||
(function() {
|
(function() {
|
||||||
var today = new Date();
|
var today = new Date();
|
||||||
var date = DateUtil.getYYYYMMDD(today);
|
this.date = DateUtil.getYYYYMMDD(today);
|
||||||
this.dbConnectManager.requestPlayerHistory(
|
|
||||||
sessionStorageManager.getMaestroID(),
|
|
||||||
date,
|
|
||||||
(function(historyRecordManager) {
|
|
||||||
if(historyRecordManager.getCount() == 0) {
|
|
||||||
console.log("history board - no data");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(var i = 0; i < historyRecordManager.getCount(); i++) {
|
if(isTypingExamApp()) {
|
||||||
var data = historyRecordManager.getAt(i);
|
this.dbService.requestWritingPlayerHistory(
|
||||||
this.printRecord(i, data.date, data.bestRecord);
|
sessionStorageManager.getWritingID(),
|
||||||
|
this.date,
|
||||||
if(date == data.date)
|
(function(historyRecordManager) {
|
||||||
this.todayBestRecord = data.bestRecord;
|
this.parseHistoryRecordManagerData(historyRecordManager);
|
||||||
}
|
}).bind(this),
|
||||||
}).bind(this)
|
(function() {
|
||||||
);
|
console.log("player history board - no data");
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.dbConnectManager.requestPlayerHistory(
|
||||||
|
this.date,
|
||||||
|
(function(historyRecordManager) {
|
||||||
|
this.parseHistoryRecordManagerData(historyRecordManager);
|
||||||
|
}).bind(this),
|
||||||
|
(function() {
|
||||||
|
console.log("player history board - no data");
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
}).bind(this),
|
}).bind(this),
|
||||||
|
|
||||||
RecordBoard.DELAY_UPDATING_RESULT_RECORD_MS
|
RecordBoard.DELAY_UPDATING_RESULT_RECORD_MS
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryBoard.prototype.calcDate = function(daysBefore) {
|
HistoryBoard.prototype.parseHistoryRecordManagerData = function(historyRecordManager) {
|
||||||
|
console.log(historyRecordManager);
|
||||||
|
|
||||||
|
if(historyRecordManager.getCount() == 0) {
|
||||||
|
console.log("history board - no data");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(var i = 0; i < historyRecordManager.getCount(); i++) {
|
||||||
|
var data = historyRecordManager.getAt(i);
|
||||||
|
this.printRecord(i, data.date, data.bestRecord);
|
||||||
|
|
||||||
|
if(this.date == data.date)
|
||||||
|
this.todayBestRecord = data.bestRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HistoryBoard.prototype.daySubtract = function(daysBefore) {
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
date.setDate(date.getDate() - daysBefore);
|
date.setDate(date.getDate() - daysBefore);
|
||||||
return date;
|
return date;
|
||||||
@@ -55,13 +82,13 @@ HistoryBoard.prototype.printRecord = function(index, date, bestRecord) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HistoryBoard.prototype.printSample = function() {
|
HistoryBoard.prototype.printSample = function() {
|
||||||
this.printRecord(0, DateUtil.getYYYYMMDD(this.calcDate(2)), 1270);
|
this.printRecord(0, DateUtil.getYYYYMMDD(this.daySubtract(2)), 1270);
|
||||||
this.printRecord(1, DateUtil.getYYYYMMDD(this.calcDate(3)), 1150);
|
this.printRecord(1, DateUtil.getYYYYMMDD(this.daySubtract(3)), 1150);
|
||||||
this.printRecord(2, DateUtil.getYYYYMMDD(this.calcDate(5)), 1080);
|
this.printRecord(2, DateUtil.getYYYYMMDD(this.daySubtract(5)), 1080);
|
||||||
this.printRecord(3, DateUtil.getYYYYMMDD(this.calcDate(7)), 960);
|
this.printRecord(3, DateUtil.getYYYYMMDD(this.daySubtract(7)), 960);
|
||||||
this.printRecord(4, DateUtil.getYYYYMMDD(this.calcDate(10)), 1020);
|
this.printRecord(4, DateUtil.getYYYYMMDD(this.daySubtract(10)), 1020);
|
||||||
this.printRecord(5, DateUtil.getYYYYMMDD(this.calcDate(15)), 840);
|
this.printRecord(5, DateUtil.getYYYYMMDD(this.daySubtract(15)), 840);
|
||||||
this.printRecord(6, DateUtil.getYYYYMMDD(this.calcDate(20)), 760);
|
this.printRecord(6, DateUtil.getYYYYMMDD(this.daySubtract(20)), 760);
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryBoard.prototype.todayBestRecord = function() {
|
HistoryBoard.prototype.todayBestRecord = function() {
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
<script src="../../game/lib/history_record_manager.js"></script>
|
<script src="../../game/lib/history_record_manager.js"></script>
|
||||||
<script src="../../game/lib/ranking_record_manager.js"></script>
|
<script src="../../game/lib/ranking_record_manager.js"></script>
|
||||||
<script src="../../game/lib/db_connect_manager.js"></script>
|
<script src="../../game/lib/db_connect_manager.js"></script>
|
||||||
|
<script src="../../game/lib/db_service.js"></script>
|
||||||
<script src="../../game/lib/button/round_rect_button.js"></script>
|
<script src="../../game/lib/button/round_rect_button.js"></script>
|
||||||
<script src="../../game/lib/button/back_button.js"></script>
|
<script src="../../game/lib/button/back_button.js"></script>
|
||||||
<script src="../../game/lib/button/fullscreen_button.js"></script>
|
<script src="../../game/lib/button/fullscreen_button.js"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user