Add: writing exam - save and update record (incompleted)
This commit is contained in:
@@ -6,7 +6,7 @@ function DBService() {
|
||||
this.maestroID = 0;
|
||||
this.playerID = 0;
|
||||
this.appName = "";
|
||||
this.dateAndTime = null;
|
||||
this.dateTime = null;
|
||||
}
|
||||
|
||||
DBService.prototype.getPath = function() {
|
||||
@@ -39,11 +39,11 @@ DBService.prototype.setAppName = function(appName) {
|
||||
}
|
||||
|
||||
DBService.prototype.setDateTime = function(date, time) {
|
||||
this.dateAndTime = date + time;
|
||||
this.dateTime = date + time;
|
||||
}
|
||||
|
||||
DBService.prototype.resetDateTime = function() {
|
||||
this.dateAndTime = null;
|
||||
this.dateTime = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,25 @@ DBService.prototype.makeXhr = function(filepath, onreadystatechange) {
|
||||
return xhr;
|
||||
}
|
||||
|
||||
// tdd setup
|
||||
DBService.prototype.tddSetup = function(command, onSucceededListener, onFailedListener) {
|
||||
var xhr = this.makeXhr(
|
||||
"php/db/tdd_setup.php",
|
||||
(function() { // onreadystatechange
|
||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||
var replyJSON = JSON.parse(xhr.responseText);
|
||||
|
||||
if(replyJSON != null)
|
||||
onSucceededListener(replyJSON);
|
||||
else
|
||||
onFailedListener(replyJSON);
|
||||
}
|
||||
}).bind(this)
|
||||
);
|
||||
xhr.send("command=" + command);
|
||||
}
|
||||
|
||||
// writing
|
||||
DBService.prototype.requestWritingPlayerList = function(onSucceededListener, onFailedListener) {
|
||||
var xhr = this.makeXhr(
|
||||
"php/writing/player_list.php",
|
||||
@@ -88,4 +107,70 @@ DBService.prototype.requestWritingInfo = function(writingID, onSucceededListener
|
||||
}).bind(this)
|
||||
);
|
||||
xhr.send("writingID=" + writingID);
|
||||
}
|
||||
|
||||
// typing exam
|
||||
DBService.prototype.addPrevHourTypingExamRecord = function(writingID, record, onSucceededListener, onFailedListener) {
|
||||
var xhr = this.makeXhr(
|
||||
"php/writing/update_result_record.php",
|
||||
(function() { // onreadystatechange
|
||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||
var replyJSON = JSON.parse(xhr.responseText);
|
||||
|
||||
if(replyJSON != null)
|
||||
onSucceededListener(replyJSON);
|
||||
else
|
||||
onFailedListener(replyJSON);
|
||||
}
|
||||
}).bind(this)
|
||||
);
|
||||
xhr.send(
|
||||
"maestroID=" + this.maestroID
|
||||
+ "&playerID=" + this.playerID
|
||||
+ "&writingID=" + writingID
|
||||
+ "&record=" + record
|
||||
+ "&isPrevHourFlag=true"
|
||||
);
|
||||
}
|
||||
|
||||
DBService.prototype.updateTypingExamRecord = function(writingID, record, onSucceededListener, onFailedListener) {
|
||||
var xhr = this.makeXhr(
|
||||
"php/writing/update_result_record.php",
|
||||
(function() { // onreadystatechange
|
||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||
var replyJSON = JSON.parse(xhr.responseText);
|
||||
|
||||
if(replyJSON != null)
|
||||
onSucceededListener(replyJSON);
|
||||
else
|
||||
onFailedListener(replyJSON);
|
||||
}
|
||||
}).bind(this)
|
||||
);
|
||||
xhr.send(
|
||||
"maestroID=" + this.maestroID
|
||||
+ "&playerID=" + this.playerID
|
||||
+ "&writingID=" + writingID
|
||||
+ "&record=" + record
|
||||
);
|
||||
}
|
||||
|
||||
DBService.prototype.getHighestRecord = function(onSucceededListener, onFailedListener) {
|
||||
var xhr = this.makeXhr(
|
||||
"php/writing/get_highest_record.php",
|
||||
(function() { // onreadystatechange
|
||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||
var replyJSON = JSON.parse(xhr.responseText);
|
||||
|
||||
if(replyJSON != null)
|
||||
onSucceededListener(replyJSON);
|
||||
else
|
||||
onFailedListener(replyJSON);
|
||||
}
|
||||
}).bind(this)
|
||||
);
|
||||
xhr.send(
|
||||
"maestroID=" + this.maestroID
|
||||
+ "&playerID=" + this.playerID
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user