Fix: update best record for every hour
This commit is contained in:
@@ -38,7 +38,7 @@ let sessionStorageManager = new SessionStorageManager();
|
||||
console.log("playingAppName : " + sessionStorageManager.playingAppName);
|
||||
console.log("playingAppKoreanName : " + sessionStorageManager.playingAppKoreanName);
|
||||
console.log("record : " + sessionStorageManager.record);
|
||||
console.log("BestRecord : " + sessionStorageManager.bestRecord);
|
||||
console.log("bestRecord : " + sessionStorageManager.bestRecord);
|
||||
}
|
||||
|
||||
function isTypingGame() {
|
||||
|
||||
@@ -30,7 +30,7 @@ class Game {
|
||||
scoreManager.addOnChangeHighScoreListener( highScore => {
|
||||
sessionStorageManager.bestRecord = highScore;
|
||||
sessionStorageManager.isNewBestRecrd = true;
|
||||
screenBottom.printBottomLeftTextWithBestRecord();
|
||||
screenBottom.printBottomLeftTextWithBestRecord(sessionStorageManager.bestRecord);
|
||||
});
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,11 @@ class Start {
|
||||
|
||||
// top
|
||||
let backButton = new BackButton( () => {
|
||||
sessionStorageManager.playingAppName = null;
|
||||
sessionStorageManager.playingAppKoreanName = null;
|
||||
sessionStorageManager.record = null;
|
||||
sessionStorageManager.bestRecord = null;
|
||||
|
||||
location.href = '../../web/client/menu_app.html';
|
||||
});
|
||||
|
||||
@@ -26,6 +31,7 @@ class Start {
|
||||
// this.printHowToPlay(appInfoManager.getHowToPlayText(sessionStorageManager.playingAppName));
|
||||
this.loadHowToPlay(sessionStorageManager.playingAppID);
|
||||
this.makeStartButton();
|
||||
|
||||
let today = new Date();
|
||||
let date = DateUtil.getYYYYMMDD(today);
|
||||
this.dbConnectManager.requestPlayerHistory(
|
||||
@@ -71,6 +77,11 @@ class Start {
|
||||
sessionStorageManager.BestRecord = Number(replyJSON["BestRecord"]);
|
||||
let highScoreWithCommas = NumberUtil.numberWithCommas(sessionStorageManager.BestRecord);
|
||||
screenBottom.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas);
|
||||
},
|
||||
replyJSON => { // no data
|
||||
sessionStorageManager.BestRecord = 0;
|
||||
let highScoreWithCommas = NumberUtil.numberWithCommas(sessionStorageManager.BestRecord);
|
||||
screenBottom.printBottomLeftText("오늘의 최고 기록 : " + highScoreWithCommas);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ function get_best_record($maestro_id, $app_id, $user_id) {
|
||||
$query = "
|
||||
SELECT BestRecord
|
||||
FROM moty_best_record
|
||||
WHERE MaestroID = ? AND AppID = ? AND UserID = ? AND DATE(RecordDateTime) = Date(NOW())
|
||||
WHERE MaestroID = ? AND AppID = ? AND UserID = ? AND DATE(RecordDateTime) = DATE(NOW())
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("iii", $maestro_id, $app_id, $user_id);
|
||||
|
||||
@@ -38,7 +38,7 @@ function get_best_record($maestro_id, $app_id, $user_id) {
|
||||
$query = "
|
||||
SELECT BestRecordID, BestRecord
|
||||
FROM moty_best_record
|
||||
WHERE MaestroID = ? AND AppID = ? AND UserID = ? AND DATE(RecordDateTime) = DATE(NOW())
|
||||
WHERE MaestroID = ? AND AppID = ? AND UserID = ? AND DATE(RecordDateTime) = DATE(NOW()) AND HOUR(RecordDateTime) = HOUR(NOW())
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param("iii", $maestro_id, $app_id, $user_id);
|
||||
@@ -71,8 +71,8 @@ function update_best_record($prev_best_record_id, $best_record) {
|
||||
|
||||
$query = "
|
||||
UPDATE moty_best_record
|
||||
SET BestRecord = ?, RecordDateTime = now()
|
||||
WHERE BestRecordID = ? AND DATE(RecordDateTime) = DATE(NOW())
|
||||
SET BestRecord = ?, RecordDateTime = NOW()
|
||||
WHERE BestRecordID = ? AND DATE(RecordDateTime) = DATE(NOW()) AND HOUR(RecordDateTime) = HOUR(NOW())
|
||||
";
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('ii', $best_record, $prev_best_record_id);
|
||||
|
||||
Reference in New Issue
Block a user