Fix: get_typing_exam_history_record
This commit is contained in:
+20
-24
@@ -129,7 +129,7 @@ DBService.prototype.requestWritingInfo = function(writingID, onSucceededListener
|
||||
// typing exam
|
||||
DBService.prototype.addPrevHourTypingExamRecord = function(writingID, record, onSucceededListener, onFailedListener) {
|
||||
var xhr = this.makeXhr(
|
||||
"php/record/update_writing_record.php",
|
||||
"php/record/update_typing_exam_record.php",
|
||||
(function() { // onreadystatechange
|
||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||
var replyJSON = JSON.parse(xhr.responseText);
|
||||
@@ -152,7 +152,7 @@ DBService.prototype.addPrevHourTypingExamRecord = function(writingID, record, on
|
||||
|
||||
DBService.prototype.updateTypingExamRecord = function(writingID, record, onSucceededListener, onFailedListener) {
|
||||
var xhr = this.makeXhr(
|
||||
"php/record/update_writing_record.php",
|
||||
"php/record/update_typing_exam_record.php",
|
||||
(function() { // onreadystatechange
|
||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||
var replyJSON = JSON.parse(xhr.responseText);
|
||||
@@ -174,7 +174,7 @@ DBService.prototype.updateTypingExamRecord = function(writingID, record, onSucce
|
||||
|
||||
DBService.prototype.getTypingExamHighestRecord = function(writingID, onSucceededListener, onFailedListener) {
|
||||
var xhr = this.makeXhr(
|
||||
"php/record/get_writing_highest_record.php",
|
||||
"php/record/get_typing_exam_highest_record.php",
|
||||
(function() { // onreadystatechange
|
||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||
var replyJSON = JSON.parse(xhr.responseText);
|
||||
@@ -194,20 +194,17 @@ DBService.prototype.getTypingExamHighestRecord = function(writingID, onSucceeded
|
||||
}
|
||||
|
||||
DBService.prototype.requestWritingPlayerHistory = function(writingID, date, onSucceededListener, onFailedListener) {
|
||||
var historyRecordManager = new HistoryRecordManager();
|
||||
|
||||
if(isDebugMode()) {
|
||||
this.loadTempPlayerHistory(historyRecordManager);
|
||||
|
||||
if(onSucceededListener !== null)
|
||||
onSucceededListener(historyRecordManager);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
var historyRecordManager = new HistoryRecordManager();
|
||||
this.loadTempPlayerHistory(historyRecordManager);
|
||||
if(onSucceededListener !== null)
|
||||
onSucceededListener(historyRecordManager);
|
||||
|
||||
return;
|
||||
*/
|
||||
|
||||
var xhr = this.makeXhr(
|
||||
"php/record/history_record.php",
|
||||
"php/record/get_typing_exam_history_record.php",
|
||||
(function() { // onreadystatechange
|
||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||
var replyJSON = JSON.parse(xhr.responseText);
|
||||
@@ -225,24 +222,24 @@ DBService.prototype.requestWritingPlayerHistory = function(writingID, date, onSu
|
||||
+ "&writingID=" + writingID
|
||||
+ "&date=" + date
|
||||
);
|
||||
*/
|
||||
}
|
||||
|
||||
DBService.prototype.parseJSONtoHistoryRecord = function(json) {
|
||||
|
||||
DBService.prototype.parseJSONtoHistoryRecord = function(jsonData) {
|
||||
var historyRecordManager = new HistoryRecordManager();
|
||||
|
||||
if(typeof json === "undefined")
|
||||
if(typeof jsonData === "undefined")
|
||||
return historyRecordManager;
|
||||
|
||||
if(typeof json.history === "undefined")
|
||||
if(typeof jsonData.history === "undefined")
|
||||
return historyRecordManager;
|
||||
|
||||
var count = json.history.length;
|
||||
var count = jsonData.history.length;
|
||||
for(var i = 0; i < count; i++) {
|
||||
var record = new HistoryRecord(
|
||||
json.history[i]["Date"],
|
||||
json.history[i]["AppName"],
|
||||
json.history[i]["HighScore"]
|
||||
jsonData.history[i]["Date"],
|
||||
jsonData.history[i]["AppName"],
|
||||
jsonData.history[i]["HighScore"]
|
||||
);
|
||||
historyRecordManager.push(record);
|
||||
}
|
||||
@@ -250,7 +247,6 @@ DBService.prototype.parseJSONtoHistoryRecord = function(json) {
|
||||
return historyRecordManager;
|
||||
}
|
||||
|
||||
|
||||
DBService.prototype.loadTempPlayerHistory = function(historyRecordManager) {
|
||||
// historyRecordManager.push(new HistoryRecord("05/14", "space_invaders", 14460));
|
||||
historyRecordManager.push(new HistoryRecord("2019-05-13 00:00:00", "space_invaders", 14460));
|
||||
|
||||
@@ -62,7 +62,9 @@ var Result = {
|
||||
|
||||
|
||||
back: function() {
|
||||
if(isTypingPracticeApp())
|
||||
if(isTypingExamApp())
|
||||
location.href = '../../web/client/menu_typing_exam.html';
|
||||
else if(isTypingPracticeApp())
|
||||
location.href = '../../web/client/menu_typing_practice.html';
|
||||
else if(isTypingTestApp())
|
||||
location.href = '../../web/client/menu_typing_test.html';
|
||||
|
||||
Reference in New Issue
Block a user