Fix: add and update TypingExamRecord, TypingExamHighestRecord

This commit is contained in:
2019-07-16 09:03:43 +09:00
parent 3cb72799d4
commit 90f4219298
4 changed files with 175 additions and 109 deletions
+3 -3
View File
@@ -29,21 +29,21 @@ if ($command === "deleteWritingRecordAll") {
$typingExam = new TypingExamCollection($dbConnector->getMysqli());
$typingExam->deleteTypingExamRecordAll(MAESTRO_ID, PLAYER_ID);
$typingExam->deleteTypingExamHighestRecordAll(MAESTRO_ID, PLAYER_ID);
$jsonBuilder->setData("deleteWritingRecordAll", "succeeded");
// $jsonBuilder->setData("deleteWritingRecordAll", "succeeded");
} elseif ($command === "deleteTypingExamRecordAll") {
include "./db_method_container.php";
include "./typing_exam_collection.php";
$typingExam = new TypingExamCollection($dbConnector->getMysqli());
$typingExam->deleteTypingExamRecordAll(MAESTRO_ID, PLAYER_ID);
$jsonBuilder->setData("deleteTypingExamRecordAll", "succeeded");
// $jsonBuilder->setData("deleteTypingExamRecordAll", "succeeded");
} elseif ($command === "deleteTypingExamHighestRecordAll") {
include "./db_method_container.php";
include "./typing_exam_collection.php";
$typingExam = new TypingExamCollection($dbConnector->getMysqli());
$typingExam->deleteTypingExamHighestRecordAll(MAESTRO_ID, PLAYER_ID);
$jsonBuilder->setData("deleteTypingExamHighestRecordAll", "succeeded");
// $jsonBuilder->setData("deleteTypingExamHighestRecordAll", "succeeded");
}
+24 -12
View File
@@ -49,6 +49,18 @@ class TypingExamCollection extends DBMethodContainer
$stmt->close();
}
public function updateRecord($typingExamRecordID, $record)
{
$query = "
UPDATE typing_exam_record
SET Record = ?, RecordDateTime = NOW()
WHERE TypingExamRecordID = ?";
$stmt = $this->mysqli->prepare($query);
$stmt->bind_param("di", $record, $typingExamRecordID);
$stmt->execute();
$stmt->close();
}
public function deleteRecord($typingExamRecordID)
{
$query = "
@@ -73,18 +85,6 @@ class TypingExamCollection extends DBMethodContainer
$stmt->close();
}
public function updateHighestRecord($typingExamHighestRecordID, $record)
{
$query = "
UPDATE typing_exam_highest_record
SET HighestRecord = ?, RecordDateTime = NOW()
WHERE TypingExamHighestRecordID = ?";
$stmt = $this->mysqli->prepare($query);
$stmt->bind_param("di", $record, $typingExamHighestRecordID);
$stmt->execute();
$stmt->close();
}
public function getThisHourRecord($maestroID, $playerID)
{
$query = "
@@ -149,6 +149,18 @@ class TypingExamCollection extends DBMethodContainer
return $resultArray;
}
public function updateHighestRecord($typingExamHighestRecordID, $record)
{
$query = "
UPDATE typing_exam_highest_record
SET HighestRecord = ?, RecordDateTime = NOW()
WHERE TypingExamHighestRecordID = ?";
$stmt = $this->mysqli->prepare($query);
$stmt->bind_param("di", $record, $typingExamHighestRecordID);
$stmt->execute();
$stmt->close();
}
}
?>