Fix: get_typing_exam_history_record

This commit is contained in:
2019-07-18 09:39:31 +09:00
parent 031be3ad1b
commit e324e9c41a
15 changed files with 83 additions and 38 deletions
+23 -1
View File
@@ -161,6 +161,28 @@ class TypingExamCollection extends DBMethodContainer
$stmt->close();
}
}
function getHistoryRecord($maestroID, $playerID, $writingID, $date) {
$query = "
SELECT DATE(RecordDateTime), MAX(Record)
FROM typing_exam_record
WHERE MaestroID = ? AND PlayerID = ? AND DATE(RecordDateTime) <= ? AND WritingID = ?
GROUP BY DATE(RecordDateTime)
ORDER BY RecordDateTime DESC
LIMIT 7";
$stmt = $this->mysqli->prepare($query);
$stmt->bind_param('iisi', $maestroID, $playerID, $date, $writingID);
$stmt->execute();
$stmt->bind_result($date, $highestRecord);
$historyRecordArray = array();
while($stmt->fetch()) {
$historyRecord['Date'] = $date;
$historyRecord['HighScore'] = $highestRecord;
$historyRecord['AppName'] = "TypingExam";
array_push($historyRecordArray, $historyRecord);
}
return $historyRecordArray;
}
}
?>