Fix: rebase code - app highest record
This commit is contained in:
@@ -60,13 +60,10 @@ var Start = {
|
|||||||
sessionStorageManager.getPlayingAppID(),
|
sessionStorageManager.getPlayingAppID(),
|
||||||
(function(replyJSON) {
|
(function(replyJSON) {
|
||||||
var appHighestRecord = replyJSON["AppHighestRecord"];
|
var appHighestRecord = replyJSON["AppHighestRecord"];
|
||||||
console.log("appHighestRecord : " + appHighestRecord);
|
|
||||||
sessionStorageManager.setAppHighestRecord(Number(appHighestRecord));
|
sessionStorageManager.setAppHighestRecord(Number(appHighestRecord));
|
||||||
screenBottomUI.printLeftTextWithAppHighestRecord(appHighestRecord);
|
screenBottomUI.printLeftTextWithAppHighestRecord(appHighestRecord);
|
||||||
}).bind(this),
|
}).bind(this),
|
||||||
(function(replyJSON) { // no data
|
(function(replyJSON) { // no data
|
||||||
var appHighestRecord = replyJSON["AppHighestRecord"];
|
|
||||||
console.log("appHighestRecord : " + appHighestRecord);
|
|
||||||
sessionStorageManager.setAppHighestRecord(0);
|
sessionStorageManager.setAppHighestRecord(0);
|
||||||
screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord());
|
screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord());
|
||||||
}).bind(this)
|
}).bind(this)
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ function get_high_score_list($maestro_id, $player_id, $appList) {
|
|||||||
$stmt = $db_conn->prepare($query);
|
$stmt = $db_conn->prepare($query);
|
||||||
$stmt->bind_param('iii', $app_id_list, $maestro_id, $player_id);
|
$stmt->bind_param('iii', $app_id_list, $maestro_id, $player_id);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->bind_result($highest_record);
|
$stmt->bind_result($app_highest_record);
|
||||||
|
|
||||||
$returnValue = $stmt->fetch();
|
$returnValue = $stmt->fetch();
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
@@ -120,10 +120,10 @@ function get_high_score_list($maestro_id, $player_id, $appList) {
|
|||||||
// $row_array['maestro_id'] = $maestro_id;
|
// $row_array['maestro_id'] = $maestro_id;
|
||||||
// $row_array['player_id'] = $player_id;
|
// $row_array['player_id'] = $player_id;
|
||||||
$row_array['AppID'] = $app_id_list;
|
$row_array['AppID'] = $app_id_list;
|
||||||
if($highest_record === NULL)
|
if($app_highest_record === NULL)
|
||||||
$row_array['AppHighestRecord'] = 0;
|
$row_array['AppHighestRecord'] = 0;
|
||||||
else
|
else
|
||||||
$row_array['AppHighestRecord'] = $highest_record;
|
$row_array['AppHighestRecord'] = $app_highest_record;
|
||||||
|
|
||||||
array_push($return_array, $row_array);
|
array_push($return_array, $row_array);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,15 +106,10 @@ function get_high_score_list($maestro_id, $player_id, $appList) {
|
|||||||
INNER JOIN app_highest_record AS AHR
|
INNER JOIN app_highest_record AS AHR
|
||||||
ON A.AppID = ? AND A.AppID = AHR.AppID AND AHR.MaestroID = ? AND AHR.PlayerID = ?
|
ON A.AppID = ? AND A.AppID = AHR.AppID AND AHR.MaestroID = ? AND AHR.PlayerID = ?
|
||||||
ORDER BY A.AppID ASC";
|
ORDER BY A.AppID ASC";
|
||||||
// SELECT MAX(BR.AppHighestRecord)
|
|
||||||
// FROM app AS A
|
|
||||||
// INNER JOIN best_record AS BR
|
|
||||||
// ON A.AppID = ? AND A.AppID = BR.AppID AND BR.MaestroID = ? AND BR.PlayerID = ?
|
|
||||||
// ORDER BY A.AppID ASC";
|
|
||||||
$stmt = $db_conn->prepare($query);
|
$stmt = $db_conn->prepare($query);
|
||||||
$stmt->bind_param('iii', $app_id_list, $maestro_id, $player_id);
|
$stmt->bind_param('iii', $app_id_list, $maestro_id, $player_id);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->bind_result($highest_record);
|
$stmt->bind_result($app_highest_record);
|
||||||
|
|
||||||
$returnValue = $stmt->fetch();
|
$returnValue = $stmt->fetch();
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
@@ -125,10 +120,10 @@ function get_high_score_list($maestro_id, $player_id, $appList) {
|
|||||||
// $row_array['maestro_id'] = $maestro_id;
|
// $row_array['maestro_id'] = $maestro_id;
|
||||||
// $row_array['player_id'] = $player_id;
|
// $row_array['player_id'] = $player_id;
|
||||||
$row_array['AppID'] = $app_id_list;
|
$row_array['AppID'] = $app_id_list;
|
||||||
if($highest_record === NULL)
|
if($app_highest_record === NULL)
|
||||||
$row_array['AppHighestRecord'] = 0;
|
$row_array['AppHighestRecord'] = 0;
|
||||||
else
|
else
|
||||||
$row_array['AppHighestRecord'] = $highest_record;
|
$row_array['AppHighestRecord'] = $app_highest_record;
|
||||||
|
|
||||||
array_push($return_array, $row_array);
|
array_push($return_array, $row_array);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,13 +11,13 @@ function get_app_highest_record($maestro_id, $app_id, $player_id) {
|
|||||||
$stmt = $db_conn->prepare($query);
|
$stmt = $db_conn->prepare($query);
|
||||||
$stmt->bind_param("iii", $maestro_id, $app_id, $player_id);
|
$stmt->bind_param("iii", $maestro_id, $app_id, $player_id);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$stmt->bind_result($highest_record);
|
$stmt->bind_result($app_highest_record);
|
||||||
$stmt->fetch();
|
$stmt->fetch();
|
||||||
$stmt->close();
|
$stmt->close();
|
||||||
|
|
||||||
return $highest_record;
|
return $app_highest_record;
|
||||||
|
|
||||||
echo "\nget_app_highest_record : $highest_record";
|
// echo "\nget_app_highest_record : $app_highest_record";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -32,10 +32,10 @@ function remove_app_highest_record($maestro_id, $app_id, $player_id) {
|
|||||||
$stmt->bind_param("iii", $maestro_id, $app_id, $player_id);
|
$stmt->bind_param("iii", $maestro_id, $app_id, $player_id);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
echo "\ndelete_app_highest_record";
|
// echo "\ndelete_app_highest_record";
|
||||||
}
|
}
|
||||||
|
|
||||||
function insert_app_highest_record($maestro_id, $app_id, $player_id, $highest_record) {
|
function insert_app_highest_record($maestro_id, $app_id, $player_id, $app_highest_record) {
|
||||||
global $db_conn;
|
global $db_conn;
|
||||||
|
|
||||||
$query = "
|
$query = "
|
||||||
@@ -43,10 +43,10 @@ function insert_app_highest_record($maestro_id, $app_id, $player_id, $highest_re
|
|||||||
VALUES (?, ?, ?, ?, NOW());
|
VALUES (?, ?, ?, ?, NOW());
|
||||||
";
|
";
|
||||||
$stmt = $db_conn->prepare($query);
|
$stmt = $db_conn->prepare($query);
|
||||||
$stmt->bind_param('iiid', $maestro_id, $player_id, $app_id, $highest_record);
|
$stmt->bind_param('iiid', $maestro_id, $player_id, $app_id, $app_highest_record);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
echo "\ninsert_app_highest_record";
|
// echo "\ninsert_app_highest_record";
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -16,7 +16,7 @@ $prev_best_record_id = -1;
|
|||||||
$prev_best_record = 0;
|
$prev_best_record = 0;
|
||||||
|
|
||||||
$prev_best_record_id = get_best_record($maestro_id, $app_id, $player_id);
|
$prev_best_record_id = get_best_record($maestro_id, $app_id, $player_id);
|
||||||
echo "id : ".$prev_best_record_id." ".$prev_best_record;
|
// echo "id : ".$prev_best_record_id." ".$prev_best_record;
|
||||||
|
|
||||||
if($prev_best_record_id === null || $prev_best_record_id < 0) {
|
if($prev_best_record_id === null || $prev_best_record_id < 0) {
|
||||||
// echo "insert";
|
// echo "insert";
|
||||||
@@ -31,18 +31,18 @@ if($prev_best_record_id === null || $prev_best_record_id < 0) {
|
|||||||
|
|
||||||
// highest record is the highest record
|
// highest record is the highest record
|
||||||
$app_highest_record = get_app_highest_record($maestro_id, $app_id, $player_id);
|
$app_highest_record = get_app_highest_record($maestro_id, $app_id, $player_id);
|
||||||
echo "\napp_highest_record : $app_highest_record";
|
// echo "\napp_highest_record : $app_highest_record";
|
||||||
|
|
||||||
echo "\nrecord : $record";
|
// echo "\nrecord : $record";
|
||||||
if($app_highest_record == null) {
|
if($app_highest_record == null) {
|
||||||
insert_app_highest_record($maestro_id, $app_id, $player_id, $record);
|
insert_app_highest_record($maestro_id, $app_id, $player_id, $record);
|
||||||
echo "\ninsert_app_highest_record : $record";
|
// echo "\ninsert_app_highest_record : $record";
|
||||||
}
|
}
|
||||||
else if($record > $app_highest_record) {
|
else if($record > $app_highest_record) {
|
||||||
remove_app_highest_record($maestro_id, $app_id, $player_id);
|
remove_app_highest_record($maestro_id, $app_id, $player_id);
|
||||||
echo "\nremove_app_highest_record";
|
// echo "\nremove_app_highest_record";
|
||||||
insert_app_highest_record($maestro_id, $app_id, $player_id, $record);
|
insert_app_highest_record($maestro_id, $app_id, $player_id, $record);
|
||||||
echo "\ninsert_app_highest_record : $record";
|
// echo "\ninsert_app_highest_record : $record";
|
||||||
}
|
}
|
||||||
|
|
||||||
$db_conn->close();
|
$db_conn->close();
|
||||||
|
|||||||
Reference in New Issue
Block a user