From e88e2edbb9efe49bd6a988de62b279824dcc91e7 Mon Sep 17 00:00:00 2001 From: "jisangs (iMac)" Date: Sun, 15 May 2022 23:12:22 +0900 Subject: [PATCH] Fix: history_record.php - order by Date() --- src/web/server/record/history_record.php | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/web/server/record/history_record.php b/src/web/server/record/history_record.php index b57cf3f..9741a0f 100644 --- a/src/web/server/record/history_record.php +++ b/src/web/server/record/history_record.php @@ -24,31 +24,19 @@ $db_conn->close(); function get_history_record($maestro_id, $app_id, $player_id, $date) { global $db_conn; - $query_header = "SELECT HR.RecordDateTime, HR.HighScore, HR.AppName - FROM ( - "; - $subquery_body = " + $query = " FROM best_record BR INNER JOIN app AS AA ON BR.MaestroID = ? AND BR.PlayerID = ? AND DATE(BR.RecordDateTime) <= ? AND BR.AppID = ? AND BR.AppID = AA.AppID GROUP BY DATE(BR.RecordDateTime) - "; - $query_tail = " - ) AS HR - ORDER BY HR.RecordDateTime DESC + ORDER BY DATE(BR.RecordDateTime) DESC LIMIT 7 "; if(is_highest_record_prefer_app($app_id)) { - $query = $query_header." - SELECT DATE(BR.RecordDateTime) AS RecordDateTime, MAX(BR.BestRecord) AS HighScore, AA.AppName AS AppName - ".$subquery_body - .$query_tail; + $query = "SELECT DATE(BR.RecordDateTime) AS RecordDateTime, MAX(BR.BestRecord) AS HighScore, AA.AppName AS AppName".$query; } else { - $query = $query_header." - SELECT DATE(BR.RecordDateTime) AS RecordDateTime, MIN(BR.BestRecord) AS HighScore, AA.AppName AS AppName - ".$subquery_body - .$query_tail; + $query = "SELECT DATE(BR.RecordDateTime) AS RecordDateTime, MIN(BR.BestRecord) AS HighScore, AA.AppName AS AppName".$query; } $stmt = $db_conn->prepare($query); $stmt->bind_param('iisi', $maestro_id, $player_id, $date, $app_id);