Fix: ranking_record_hour, day, month SQL bug
This commit is contained in:
@@ -26,7 +26,7 @@ function get_ranking_record_day($maestro_id, $date, $app_id) {
|
||||
|
||||
$query = "
|
||||
FROM best_record BR, player U
|
||||
WHERE BR.MaestroID = ? AND BR.playerID = U.playerID AND DATE(BR.RecordDateTime) = ? AND AppID = ?
|
||||
WHERE BR.MaestroID = ? AND BR.playerID = U.playerID AND YEAR(BR.RecordDateTime) = YEAR(?) AND MONTH(BR.RecordDateTime) = MONTH(?) AND DAYOFMONTH(BR.RecordDateTime) = DAYOFMONTH(?) AND AppID = ?
|
||||
GROUP BY BR.playerID
|
||||
";
|
||||
if(is_highest_record_prefer_app($app_id)) {
|
||||
@@ -37,7 +37,7 @@ function get_ranking_record_day($maestro_id, $date, $app_id) {
|
||||
$query = $query."ORDER BY MIN(BR.BestRecord) ASC;";
|
||||
}
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('isi', $maestro_id, $date, $app_id);
|
||||
$stmt->bind_param('isssi', $maestro_id, $date, $date, $date, $app_id);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($playerID, $name, $high_score);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ function get_ranking_record_hour($maestro_id, $date, $time, $app_id) {
|
||||
|
||||
$query = "
|
||||
FROM best_record BR, player U
|
||||
WHERE BR.MaestroID = ? AND BR.playerID = U.playerID AND DATE(BR.RecordDateTime) = ? AND HOUR(BR.RecordDateTime) = HOUR(?) AND AppID = ?
|
||||
WHERE BR.MaestroID = ? AND BR.playerID = U.playerID AND YEAR(BR.RecordDateTime) = YEAR(?) AND MONTH(BR.RecordDateTime) = MONTH(?) AND DAYOFMONTH(BR.RecordDateTime) = DAYOFMONTH(?) AND HOUR(BR.RecordDateTime) = HOUR(?) AND AppID = ?
|
||||
GROUP BY BR.playerID
|
||||
";
|
||||
if(is_highest_record_prefer_app($app_id)) {
|
||||
@@ -37,7 +37,7 @@ function get_ranking_record_hour($maestro_id, $date, $time, $app_id) {
|
||||
$query = $query."ORDER BY MIN(BR.BestRecord) ASC;";
|
||||
}
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('issi', $maestro_id, $date, $time, $app_id);
|
||||
$stmt->bind_param('issssi', $maestro_id, $date, $date, $date, $time, $app_id);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($playerID, $name, $high_score);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ function get_ranking_record_month($maestro_id, $date, $time, $app_id) {
|
||||
|
||||
$query = "
|
||||
FROM best_record BR, player U
|
||||
WHERE BR.MaestroID = ? AND BR.playerID = U.playerID AND MONTH(BR.RecordDateTime) = MONTH(?) AND AppID = ?
|
||||
WHERE BR.MaestroID = ? AND BR.playerID = U.playerID AND YEAR(BR.RecordDateTime) = YEAR(?) AND MONTH(BR.RecordDateTime) = MONTH(?) AND AppID = ?
|
||||
GROUP BY BR.playerID
|
||||
";
|
||||
if(is_highest_record_prefer_app($app_id)) {
|
||||
@@ -37,7 +37,7 @@ function get_ranking_record_month($maestro_id, $date, $time, $app_id) {
|
||||
$query = $query."ORDER BY MIN(BR.BestRecord) ASC;";
|
||||
}
|
||||
$stmt = $db_conn->prepare($query);
|
||||
$stmt->bind_param('isi', $maestro_id, $date, $app_id);
|
||||
$stmt->bind_param('issi', $maestro_id, $date, $date, $app_id);
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($playerID, $name, $high_score);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user