Fix: bestRecord bug

This commit is contained in:
2018-06-06 07:34:45 +09:00
parent b4f0531db0
commit 26b47536dc
7 changed files with 29 additions and 12 deletions
+6 -4
View File
@@ -8,12 +8,14 @@ class ScoreManager {
}
resetScore() {
sessionStorageManager.record = 0;
this.score = Number(sessionStorageManager.record);
// this.score = Number(sessionStorageManager.record);
this.score = 0;
sessionStorageManager.record = this.score;
if(sessionStorageManager.bestRecord === null)
sessionStorageManager.bestRecord = 0;
this.highScore = Number(sessionStorageManager.bestRecord);
this.highScore = 0;
else
this.highScore = Number(sessionStorageManager.bestRecord);
}
callListener(functionArray) {
+2 -1
View File
@@ -64,7 +64,8 @@ class ScreenBottom {
}
printBottomLeftTextWithBestRecord(bestRecord) {
this.printBottomLeftText("오늘의 최고 기록 : " + bestRecord);
let highScoreWithCommas = NumberUtil.numberWithCommas(bestRecord);
this.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas);
}
}
+9
View File
@@ -83,4 +83,13 @@ class SessionStorageManager {
return sessionStorage.getItem("isNewBestRecord");
}
resetPlayingAppData() {
sessionStorage.playingAppID = null;
sessionStorage.playingAppName = null;
sessionStorage.playingAppKoreanName = null;
sessionStorage.record = null;
sessionStorage.bestRecord = null;
}
}
+2
View File
@@ -10,6 +10,7 @@ class Game {
// top
let backButton = new BackButton( () => {
sessionStorageManager.resetPlayingAppData();
location.href = '../../web/client/menu_app.html';
});
@@ -28,6 +29,7 @@ class Game {
scoreBoard.printScore(NumberUtil.numberWithCommas(score));
});
scoreManager.addOnChangeHighScoreListener( highScore => {
console.log(highScore);
sessionStorageManager.bestRecord = highScore;
sessionStorageManager.isNewBestRecrd = true;
screenBottom.printBottomLeftTextWithBestRecord(sessionStorageManager.bestRecord);
+1
View File
@@ -16,6 +16,7 @@ class Result {
// top
let backButton = new BackButton( () => {
sessionStorageManager.resetPlayingAppData();
location.href = '../../web/client/menu_app.html';
});
+8 -6
View File
@@ -74,14 +74,16 @@ class Start {
sessionStorageManager.playerUserID,
sessionStorageManager.playingAppID,
replyJSON => {
sessionStorageManager.BestRecord = Number(replyJSON["BestRecord"]);
let highScoreWithCommas = NumberUtil.numberWithCommas(sessionStorageManager.BestRecord);
screenBottom.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas);
sessionStorageManager.bestRecord = Number(replyJSON["BestRecord"]);
// let highScoreWithCommas = NumberUtil.numberWithCommas(sessionStorageManager.bestRecord);
// screenBottom.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas);
screenBottom.printBottomLeftTextWithBestRecord(sessionStorageManager.bestRecord);
},
replyJSON => { // no data
sessionStorageManager.BestRecord = 0;
let highScoreWithCommas = NumberUtil.numberWithCommas(sessionStorageManager.BestRecord);
screenBottom.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas);
sessionStorageManager.bestRecord = 0;
// let highScoreWithCommas = NumberUtil.numberWithCommas(sessionStorageManager.bestRecord);
// screenBottom.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas);
screenBottom.printBottomLeftTextWithBestRecord(sessionStorageManager.bestRecord);
}
);
}
+1 -1
View File
@@ -29,7 +29,7 @@ function get_history_record($maestro_id, $app_id, $user_id, $date) {
SELECT DATE(BR.RecordDateTime) AS Date, MAX(BR.BestRecord) AS HighScore, AA.AppName AS AppName
FROM moty_best_record BR
INNER JOIN moty_app AS AA
ON BR.MaestroID = ? AND BR.UserID = ? AND DATE(BR.RecordDateTime) < ? AND BR.AppID = ? AND BR.AppID = AA.AppID
ON BR.MaestroID = ? AND BR.UserID = ? AND DATE(BR.RecordDateTime) <= ? AND BR.AppID = ? AND BR.AppID = AA.AppID
GROUP BY DATE(BR.RecordDateTime)
ORDER BY BR.RecordDateTime DESC
LIMIT 7