Fix: bestRecord bug
This commit is contained in:
@@ -8,12 +8,14 @@ class ScoreManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resetScore() {
|
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)
|
if(sessionStorageManager.bestRecord === null)
|
||||||
sessionStorageManager.bestRecord = 0;
|
this.highScore = 0;
|
||||||
this.highScore = Number(sessionStorageManager.bestRecord);
|
else
|
||||||
|
this.highScore = Number(sessionStorageManager.bestRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
callListener(functionArray) {
|
callListener(functionArray) {
|
||||||
|
|||||||
@@ -64,7 +64,8 @@ class ScreenBottom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
printBottomLeftTextWithBestRecord(bestRecord) {
|
printBottomLeftTextWithBestRecord(bestRecord) {
|
||||||
this.printBottomLeftText("오늘의 최고 기록 : " + bestRecord);
|
let highScoreWithCommas = NumberUtil.numberWithCommas(bestRecord);
|
||||||
|
this.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -83,4 +83,13 @@ class SessionStorageManager {
|
|||||||
return sessionStorage.getItem("isNewBestRecord");
|
return sessionStorage.getItem("isNewBestRecord");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetPlayingAppData() {
|
||||||
|
sessionStorage.playingAppID = null;
|
||||||
|
sessionStorage.playingAppName = null;
|
||||||
|
sessionStorage.playingAppKoreanName = null;
|
||||||
|
sessionStorage.record = null;
|
||||||
|
sessionStorage.bestRecord = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,7 @@ class Game {
|
|||||||
|
|
||||||
// top
|
// top
|
||||||
let backButton = new BackButton( () => {
|
let backButton = new BackButton( () => {
|
||||||
|
sessionStorageManager.resetPlayingAppData();
|
||||||
location.href = '../../web/client/menu_app.html';
|
location.href = '../../web/client/menu_app.html';
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -28,6 +29,7 @@ class Game {
|
|||||||
scoreBoard.printScore(NumberUtil.numberWithCommas(score));
|
scoreBoard.printScore(NumberUtil.numberWithCommas(score));
|
||||||
});
|
});
|
||||||
scoreManager.addOnChangeHighScoreListener( highScore => {
|
scoreManager.addOnChangeHighScoreListener( highScore => {
|
||||||
|
console.log(highScore);
|
||||||
sessionStorageManager.bestRecord = highScore;
|
sessionStorageManager.bestRecord = highScore;
|
||||||
sessionStorageManager.isNewBestRecrd = true;
|
sessionStorageManager.isNewBestRecrd = true;
|
||||||
screenBottom.printBottomLeftTextWithBestRecord(sessionStorageManager.bestRecord);
|
screenBottom.printBottomLeftTextWithBestRecord(sessionStorageManager.bestRecord);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class Result {
|
|||||||
|
|
||||||
// top
|
// top
|
||||||
let backButton = new BackButton( () => {
|
let backButton = new BackButton( () => {
|
||||||
|
sessionStorageManager.resetPlayingAppData();
|
||||||
location.href = '../../web/client/menu_app.html';
|
location.href = '../../web/client/menu_app.html';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -74,14 +74,16 @@ class Start {
|
|||||||
sessionStorageManager.playerUserID,
|
sessionStorageManager.playerUserID,
|
||||||
sessionStorageManager.playingAppID,
|
sessionStorageManager.playingAppID,
|
||||||
replyJSON => {
|
replyJSON => {
|
||||||
sessionStorageManager.BestRecord = Number(replyJSON["BestRecord"]);
|
sessionStorageManager.bestRecord = Number(replyJSON["BestRecord"]);
|
||||||
let highScoreWithCommas = NumberUtil.numberWithCommas(sessionStorageManager.BestRecord);
|
// let highScoreWithCommas = NumberUtil.numberWithCommas(sessionStorageManager.bestRecord);
|
||||||
screenBottom.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas);
|
// screenBottom.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas);
|
||||||
|
screenBottom.printBottomLeftTextWithBestRecord(sessionStorageManager.bestRecord);
|
||||||
},
|
},
|
||||||
replyJSON => { // no data
|
replyJSON => { // no data
|
||||||
sessionStorageManager.BestRecord = 0;
|
sessionStorageManager.bestRecord = 0;
|
||||||
let highScoreWithCommas = NumberUtil.numberWithCommas(sessionStorageManager.BestRecord);
|
// let highScoreWithCommas = NumberUtil.numberWithCommas(sessionStorageManager.bestRecord);
|
||||||
screenBottom.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas);
|
// screenBottom.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas);
|
||||||
|
screenBottom.printBottomLeftTextWithBestRecord(sessionStorageManager.bestRecord);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
SELECT DATE(BR.RecordDateTime) AS Date, MAX(BR.BestRecord) AS HighScore, AA.AppName AS AppName
|
||||||
FROM moty_best_record BR
|
FROM moty_best_record BR
|
||||||
INNER JOIN moty_app AS AA
|
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)
|
GROUP BY DATE(BR.RecordDateTime)
|
||||||
ORDER BY BR.RecordDateTime DESC
|
ORDER BY BR.RecordDateTime DESC
|
||||||
LIMIT 7
|
LIMIT 7
|
||||||
|
|||||||
Reference in New Issue
Block a user