diff --git a/src/web/server/maestro/delete_test_player_record.php b/src/web/server/maestro/delete_test_player_record.php index 56510fd..b59c836 100644 --- a/src/web/server/maestro/delete_test_player_record.php +++ b/src/web/server/maestro/delete_test_player_record.php @@ -16,6 +16,13 @@ if($maestro_test_player_id === null) { delete_maestro_test_player_best_record($maestro_test_player_id); delete_maestro_test_player_app_highest_record($maestro_test_player_id); +delete_maestro_test_typing_exam_highest_record($maestro_test_player_id); +delete_maestro_test_typing_exam_record($maestro_test_player_id); + +delete_maestro_test_license_score_record($maestro_test_player_id); +delete_maestro_test_license_time($maestro_test_player_id); + + $replyJSON["PlayerID"] = $maestro_test_player_id; $replyJSON["RESULT"] = "ok"; echo json_encode($replyJSON, JSON_UNESCAPED_UNICODE); @@ -44,6 +51,8 @@ function get_maestro_test_player_id($maestro_id) { return $maestro_test_player_id; } + + function delete_maestro_test_player_best_record($player_id) { global $db_conn; @@ -55,10 +64,6 @@ function delete_maestro_test_player_best_record($player_id) { $stmt = $db_conn->prepare($query); $stmt->bind_param('i', $player_id); $stmt->execute(); - // $stmt->bind_result($maestro_test_player_id); - // while($stmt->fetch()) { - // ; - // } $stmt->fetch(); $stmt->close(); } @@ -74,10 +79,71 @@ function delete_maestro_test_player_app_highest_record($player_id) { $stmt = $db_conn->prepare($query); $stmt->bind_param('i', $player_id); $stmt->execute(); - // $stmt->bind_result($maestro_test_player_id); - // while($stmt->fetch()) { - // ; - // } + $stmt->fetch(); + $stmt->close(); +} + + + +function delete_maestro_test_typing_exam_highest_record($player_id) { + global $db_conn; + + $query = " + DELETE + FROM typing_exam_highest_record + WHERE PlayerID = ? + "; + $stmt = $db_conn->prepare($query); + $stmt->bind_param('i', $player_id); + $stmt->execute(); + $stmt->fetch(); + $stmt->close(); +} + +function delete_maestro_test_typing_exam_record($player_id) { + global $db_conn; + + $query = " + DELETE + FROM typing_exam_record + WHERE PlayerID = ? + "; + $stmt = $db_conn->prepare($query); + $stmt->bind_param('i', $player_id); + $stmt->execute(); + $stmt->fetch(); + $stmt->close(); +} + + + + +function delete_maestro_test_license_score_record($player_id) { + global $db_conn; + + $query = " + DELETE + FROM license_score + WHERE PlayerID = ? + "; + $stmt = $db_conn->prepare($query); + $stmt->bind_param('i', $player_id); + $stmt->execute(); + $stmt->fetch(); + $stmt->close(); +} + +function delete_maestro_test_license_time($player_id) { + global $db_conn; + + $query = " + DELETE + FROM license_time + WHERE PlayerID = ? + "; + $stmt = $db_conn->prepare($query); + $stmt->bind_param('i', $player_id); + $stmt->execute(); $stmt->fetch(); $stmt->close(); } diff --git a/src/web/server/player/delete_player.php b/src/web/server/player/delete_player.php index b683756..a9203a3 100644 --- a/src/web/server/player/delete_player.php +++ b/src/web/server/player/delete_player.php @@ -10,6 +10,10 @@ $playerID = $_POST["player_id"]; deleteAppHighestRecord($maestroID, $playerID); deleteBestRecord($maestroID, $playerID); + +deleteTypingExamHighestRecord($maestroID, $playerID); +deleteTypingExamRecord($maestroID, $playerID); + deleteLicenseScore($maestroID, $playerID); deleteLicenseTime($maestroID, $playerID); @@ -65,6 +69,35 @@ function deleteBestRecord($maestroID, $playerID) { $stmt->close(); } + +function deleteTypingExamHighestRecord($maestroID, $playerID) { + global $db_conn; + + $query = " + DELETE FROM typing_exam_highest_record + WHERE MaestroID = ? AND PlayerID = ? + "; + $stmt = $db_conn->prepare($query); + $stmt->bind_param("ii", $maestroID, $playerID); + $result = $stmt->execute(); + $stmt->close(); +} + +function deleteTypingExamRecord($maestroID, $playerID) { + global $db_conn; + + $query = " + DELETE FROM typing_exam_record + WHERE MaestroID = ? AND PlayerID = ? + "; + $stmt = $db_conn->prepare($query); + $stmt->bind_param("ii", $maestroID, $playerID); + $result = $stmt->execute(); + $stmt->close(); +} + + + function deleteLicenseScore($maestroID, $playerID) { global $db_conn; diff --git a/test/tdd.js b/test/tdd.js index cb8be4c..1dbb022 100644 --- a/test/tdd.js +++ b/test/tdd.js @@ -155,9 +155,10 @@ QUnit.test( "AppList", function( assert ) { language, (function(jsonData) { assert.equal(jsonData.appGroup, appGroup, "#2 appGroup : typing exam, Korean"); - assert.equal(jsonData.appData.appList.length, 5, "appList"); - assert.equal(jsonData.appData.activeAppList.length, 5, "activeAppList"); - assert.equal(jsonData.appData.highestRecordList.length, 5, "highestRecordList"); + // console.log(jsonData.appData); + assert.equal(jsonData.appData.appList.length, 7, "appList"); + assert.equal(jsonData.appData.activeAppList.length, 7, "activeAppList"); + assert.equal(jsonData.appData.highestRecordList.length, 7, "highestRecordList"); asyncExamKorean(); }).bind(this), (function(jsonData) { @@ -177,9 +178,9 @@ QUnit.test( "AppList", function( assert ) { (function(jsonData) { assert.equal(jsonData.appGroup, appGroup, "#2 appGroup : typing exam, English"); // console.log(jsonData.appData); - assert.equal(jsonData.appData.appList.length, 4, "appList"); - assert.equal(jsonData.appData.activeAppList.length, 4, "activeAppList"); - assert.equal(jsonData.appData.highestRecordList.length, 4, "highestRecordList"); + assert.equal(jsonData.appData.appList.length, 6, "appList"); + assert.equal(jsonData.appData.activeAppList.length, 6, "activeAppList"); + assert.equal(jsonData.appData.highestRecordList.length, 6, "highestRecordList"); asyncExamEnglish(); }).bind(this), (function(jsonData) { @@ -240,9 +241,10 @@ QUnit.test( "AppList", function( assert ) { language, (function(jsonData) { assert.equal(jsonData.appGroup, appGroup, "#4 appGroup : mouse play"); - assert.equal(jsonData.appData.appList.length, 5, "appList"); - assert.equal(jsonData.appData.activeAppList.length, 4, "activeAppList"); - assert.equal(jsonData.appData.highestRecordList.length, 5, "highestRecordList"); + // console.log(jsonData.appData); + assert.equal(jsonData.appData.appList.length, 6, "appList"); + assert.equal(jsonData.appData.activeAppList.length, 6, "activeAppList"); + assert.equal(jsonData.appData.highestRecordList.length, 6, "highestRecordList"); asyncMousePlay(); }).bind(this), (function(jsonData) { @@ -488,7 +490,7 @@ QUnit.test( "TypingExamDB - minus record", function( assert ) { function addPrevHourTypingExamRecord() { - console.log("record : " + RECORD); + // console.log("record : " + RECORD); dbService.addPrevHourTypingExamRecord( WRITING_ID, //writingRecord RECORD, // record : -117.89 @@ -505,7 +507,7 @@ QUnit.test( "TypingExamDB - minus record", function( assert ) { // add this hour record + 10 function updateTypingExamRecord() { - console.log("record : " + (RECORD + 20)); + // console.log("record : " + (RECORD + 20)); dbService.updateTypingExamRecord( WRITING_ID, //writingRecord RECORD + 20, // record @@ -579,7 +581,7 @@ QUnit.test( "TypingExamDB - minus record", function( assert ) { // update this hour record function updateTypingExamRecord3() { - console.log("record : " + (RECORD - 10)); + // console.log("record : " + (RECORD - 10)); dbService.updateTypingExamRecord( WRITING_ID, //writingRecord RECORD - 10, // record