Add: writing exam - save and update record (incompleted)
This commit is contained in:
@@ -6,7 +6,7 @@ function DBService() {
|
|||||||
this.maestroID = 0;
|
this.maestroID = 0;
|
||||||
this.playerID = 0;
|
this.playerID = 0;
|
||||||
this.appName = "";
|
this.appName = "";
|
||||||
this.dateAndTime = null;
|
this.dateTime = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBService.prototype.getPath = function() {
|
DBService.prototype.getPath = function() {
|
||||||
@@ -39,11 +39,11 @@ DBService.prototype.setAppName = function(appName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DBService.prototype.setDateTime = function(date, time) {
|
DBService.prototype.setDateTime = function(date, time) {
|
||||||
this.dateAndTime = date + time;
|
this.dateTime = date + time;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBService.prototype.resetDateTime = function() {
|
DBService.prototype.resetDateTime = function() {
|
||||||
this.dateAndTime = null;
|
this.dateTime = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -56,6 +56,25 @@ DBService.prototype.makeXhr = function(filepath, onreadystatechange) {
|
|||||||
return xhr;
|
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) {
|
DBService.prototype.requestWritingPlayerList = function(onSucceededListener, onFailedListener) {
|
||||||
var xhr = this.makeXhr(
|
var xhr = this.makeXhr(
|
||||||
"php/writing/player_list.php",
|
"php/writing/player_list.php",
|
||||||
@@ -89,3 +108,69 @@ DBService.prototype.requestWritingInfo = function(writingID, onSucceededListener
|
|||||||
);
|
);
|
||||||
xhr.send("writingID=" + writingID);
|
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
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -17,7 +17,11 @@ var TypingExamination = {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.dbConnectManager = new DBConnectManager();
|
// this.dbConnectManager = new DBConnectManager();
|
||||||
|
this.dbService = new DBService();
|
||||||
|
this.dbService.setMaestroID(sessionStorageManager.getMaestroID());
|
||||||
|
this.dbService.setPlayerID(sessionStorageManager.getPlayerID());
|
||||||
|
|
||||||
sessionStorageManager.setRecord(0);
|
sessionStorageManager.setRecord(0);
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
@@ -304,12 +308,20 @@ var TypingExamination = {
|
|||||||
|
|
||||||
updateResultRecord: function() {
|
updateResultRecord: function() {
|
||||||
if(sessionStorageManager.getMaestroAccountType() < 100) { // experience account
|
if(sessionStorageManager.getMaestroAccountType() < 100) { // experience account
|
||||||
|
this.dbService.updateTypingExamRecord(
|
||||||
|
sessionStorageManager.getMaestroID(),
|
||||||
|
sessionStorageManager.getPlayerID(),
|
||||||
|
sessionStorageManager.getPlayingAppID(),
|
||||||
|
sessionStorageManager.getRecord()
|
||||||
|
);
|
||||||
|
/*
|
||||||
this.dbConnectManager.updateResultRecord(
|
this.dbConnectManager.updateResultRecord(
|
||||||
sessionStorageManager.getMaestroID(),
|
sessionStorageManager.getMaestroID(),
|
||||||
sessionStorageManager.getPlayerID(),
|
sessionStorageManager.getPlayerID(),
|
||||||
sessionStorageManager.getPlayingAppID(),
|
sessionStorageManager.getPlayingAppID(),
|
||||||
sessionStorageManager.getRecord()
|
sessionStorageManager.getRecord()
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -333,11 +345,7 @@ var TypingExamination = {
|
|||||||
|
|
||||||
|
|
||||||
loadExaminationContent: function() {
|
loadExaminationContent: function() {
|
||||||
var dbService = new DBService();
|
this.dbService.requestWritingInfo(
|
||||||
dbService.setMaestroID(sessionStorageManager.getMaestroID());
|
|
||||||
dbService.setPlayerID(sessionStorageManager.getPlayerID());
|
|
||||||
|
|
||||||
dbService.requestWritingInfo(
|
|
||||||
sessionStorageManager.getWritingID(),
|
sessionStorageManager.getWritingID(),
|
||||||
(function(jsonData) { // onSucceeded
|
(function(jsonData) { // onSucceeded
|
||||||
this.downloadListSucceeded(jsonData);
|
this.downloadListSucceeded(jsonData);
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
// get parameters from client
|
||||||
|
$command = $_POST["command"];
|
||||||
|
|
||||||
|
|
||||||
|
include "./../lib/json_builder.php";
|
||||||
|
include "./../lib/connect_db.php";
|
||||||
|
|
||||||
|
$jsonBuilder = new JsonBuilder();
|
||||||
|
$dbConnector = new DBConnector();
|
||||||
|
|
||||||
|
$isConnected = $dbConnector->connectDB();
|
||||||
|
if (!$isConnected) {
|
||||||
|
$jsonBuilder->setErrorMessage("DB connection : failed");
|
||||||
|
$jsonBuilder->sendResultFail();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const MAESTRO_ID = 3; // 삼화초
|
||||||
|
const PLAYER_ID = 35; // 박지상
|
||||||
|
|
||||||
|
if ($command === "deleteWritingRecordAll") {
|
||||||
|
include "./db_method_container.php";
|
||||||
|
include "./typing_exam_collection.php";
|
||||||
|
|
||||||
|
$typingExam = new TypingExamCollection($dbConnector->getMysqli());
|
||||||
|
$typingExam->deleteTypingExamRecordAll(MAESTRO_ID, PLAYER_ID);
|
||||||
|
$typingExam->deleteTypingExamHighestRecordAll(MAESTRO_ID, PLAYER_ID);
|
||||||
|
$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");
|
||||||
|
} 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->sendResultSuccess();
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -0,0 +1,133 @@
|
|||||||
|
<?php
|
||||||
|
class TypingExamCollection extends DBMethodContainer
|
||||||
|
{
|
||||||
|
// begin - for TDD
|
||||||
|
public function deleteTypingExamRecordAll($maestroID, $playerID) {
|
||||||
|
$query = "
|
||||||
|
DELETE
|
||||||
|
FROM typing_exam_record
|
||||||
|
WHERE MaestroID = ? AND PlayerID = ?";
|
||||||
|
$stmt = $this->mysqli->prepare($query);
|
||||||
|
$stmt->bind_param('ii', $maestroID, $playerID);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->fetch();
|
||||||
|
$stmt->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteTypingExamHighestRecordAll($maestroID, $playerID) {
|
||||||
|
$query = "
|
||||||
|
DELETE
|
||||||
|
FROM typing_exam_highest_record
|
||||||
|
WHERE MaestroID = ? AND PlayerID = ?";
|
||||||
|
$stmt = $this->mysqli->prepare($query);
|
||||||
|
$stmt->bind_param('ii', $maestroID, $playerID);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->fetch();
|
||||||
|
$stmt->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addPrevHourRecord($maestroID, $playerID, $writingID, $record)
|
||||||
|
{
|
||||||
|
$query = "
|
||||||
|
INSERT INTO typing_exam_record (MaestroID, PlayerID, WritingID, Record, RecordDateTime)
|
||||||
|
VALUES (?, ?, ?, ?, DATE_SUB(NOW(), INTERVAL 1 HOUR))";
|
||||||
|
$stmt = $this->mysqli->prepare($query);
|
||||||
|
$stmt->bind_param("iiid", $maestroID, $playerID, $writingID, $record);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->close();
|
||||||
|
}
|
||||||
|
// end - for TDD
|
||||||
|
|
||||||
|
public function addRecord($maestroID, $playerID, $writingID, $record)
|
||||||
|
{
|
||||||
|
$query = "
|
||||||
|
INSERT INTO typing_exam_record (MaestroID, PlayerID, WritingID, Record, RecordDateTime)
|
||||||
|
VALUES (?, ?, ?, ?, NOW())";
|
||||||
|
$stmt = $this->mysqli->prepare($query);
|
||||||
|
$stmt->bind_param("iiid", $maestroID, $playerID, $writingID, $record);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteRecord($typingExamRecordID)
|
||||||
|
{
|
||||||
|
$query = "
|
||||||
|
DELETE
|
||||||
|
FROM typing_exam_record
|
||||||
|
WHERE TypingExamRecordID = ?
|
||||||
|
";
|
||||||
|
$stmt = $this->mysqli->prepare($query);
|
||||||
|
$stmt->bind_param('i', $typingExamRecordID);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addHighestRecord($maestroID, $playerID, $writingID, $record)
|
||||||
|
{
|
||||||
|
$query = "
|
||||||
|
INSERT INTO typing_exam_highest_record (MaestroID, PlayerID, WritingID, HighestRecord, RecordDateTime)
|
||||||
|
VALUES (?, ?, ?, ?, NOW())";
|
||||||
|
$stmt = $this->mysqli->prepare($query);
|
||||||
|
$stmt->bind_param("iiid", $maestroID, $playerID, $writingID, $record);
|
||||||
|
$stmt->execute();
|
||||||
|
$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("id", $typingExamHighestRecordID, $record);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getThisHourRecord($maestroID, $playerID)
|
||||||
|
{
|
||||||
|
$query = "
|
||||||
|
SELECT TypingExamRecordID, Record
|
||||||
|
FROM typing_exam_record
|
||||||
|
WHERE MaestroID = ? AND PlayerID = ? AND DATE(RecordDateTime) = DATE(NOW()) AND HOUR(RecordDateTime) = HOUR(NOW())";
|
||||||
|
$stmt = $this->mysqli->prepare($query);
|
||||||
|
$stmt->bind_param("ii", $maestroID, $playerID);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($typingExamRecordID, $record);
|
||||||
|
|
||||||
|
$stmt->fetch();
|
||||||
|
$result = array();
|
||||||
|
$result["typingExamRecordID"] = $typingExamRecordID;
|
||||||
|
$result["record"] = $record;
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHighestRecord($maestroID, $playerID)
|
||||||
|
{
|
||||||
|
$query = "
|
||||||
|
SELECT WritingID, HighestRecord
|
||||||
|
FROM typing_exam_highest_record
|
||||||
|
WHERE MaestroID = ? AND PlayerID = ?";
|
||||||
|
$stmt = $this->mysqli->prepare($query);
|
||||||
|
$stmt->bind_param("ii", $maestroID, $playerID);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($writingID, $highestRecord);
|
||||||
|
|
||||||
|
$resultArray = array();
|
||||||
|
while($stmt->fetch()) {
|
||||||
|
$rowArray = array();
|
||||||
|
$rowArray["writingID"] = $writingID;
|
||||||
|
$rowArray["highestRecord"] = $highestRecord;
|
||||||
|
array_push($resultArray, $rowArray);
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
return $resultArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
$maestroID = $_POST["maestroID"];
|
||||||
|
$playerID = $_POST["playerID"];
|
||||||
|
|
||||||
|
include "./../lib/json_builder.php";
|
||||||
|
include "./../lib/connect_db.php";
|
||||||
|
|
||||||
|
$jsonBuilder = new JsonBuilder();
|
||||||
|
$dbConnector = new DBConnector();
|
||||||
|
|
||||||
|
$isConnected = $dbConnector->connectDB();
|
||||||
|
if (!$isConnected) {
|
||||||
|
$jsonBuilder->setErrorMessage("DB connection : failed");
|
||||||
|
$jsonBuilder->sendResultFail();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
include "./../db/db_method_container.php";
|
||||||
|
include "./../db/typing_exam_collection.php";
|
||||||
|
|
||||||
|
$typingExam = new TypingExamCollection($dbConnector->getMysqli());
|
||||||
|
|
||||||
|
$highestRecordArray = $typingExam->getHighestRecord();
|
||||||
|
$jsonBuilder->setData("highestRecordArray", $highestRecordArray);
|
||||||
|
|
||||||
|
if ($highestRecordArray === null) {
|
||||||
|
$jsonBuilder->sendResultFail();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$jsonBuilder->sendResultSuccess();
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
|
||||||
|
$maestroID = $_POST["maestroID"];
|
||||||
|
$playerID = $_POST["playerID"];
|
||||||
|
$writingID = $_POST["writingID"];
|
||||||
|
$record = $_POST["record"];
|
||||||
|
$isPrevHourFlag = $_POST["isPrevHourFlag"];
|
||||||
|
|
||||||
|
include "./../lib/json_builder.php";
|
||||||
|
include "./../lib/connect_db.php";
|
||||||
|
|
||||||
|
$jsonBuilder = new JsonBuilder();
|
||||||
|
$dbConnector = new DBConnector();
|
||||||
|
|
||||||
|
$isConnected = $dbConnector->connectDB();
|
||||||
|
if (!$isConnected) {
|
||||||
|
$jsonBuilder->setErrorMessage("DB connection : failed");
|
||||||
|
$jsonBuilder->sendResultFail();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
include "./../db/db_method_container.php";
|
||||||
|
include "./../db/typing_exam_collection.php";
|
||||||
|
|
||||||
|
$typingExam = new TypingExamCollection($dbConnector->getMysqli());
|
||||||
|
|
||||||
|
if (isset($isPrevHourFlag)) {
|
||||||
|
$typingExam->addPrevHourRecord($maestroID, $playerID, $writingID, $record);
|
||||||
|
$jsonBuilder->setData("prevHourRecord", "added");
|
||||||
|
$jsonBuilder->sendResultSuccess();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$thisHourRecordData = $typingExam->getThisHourRecord($maestroID, $playerID);
|
||||||
|
if ($thisHourRecordData === null) {
|
||||||
|
$typingExam->addRecord($maestroID, $playerID, $writingID, $record);
|
||||||
|
$jsonBuilder->setData("record", "added");
|
||||||
|
} else {
|
||||||
|
if ($record > $thisHourRecordData["record"]) {
|
||||||
|
$typingExam->deleteRecord($thisHourRecordData["ID"]);
|
||||||
|
$typingExam->addRecord($maestroID, $playerID, $writingID, $record);
|
||||||
|
$jsonBuilder->setData("record", "updated");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$highestRecordData = $typingExam->getHighestRecord($maestroID, $playerID);
|
||||||
|
$jsonBuilder->setData("highestRecordData", $highestRecordData);
|
||||||
|
if (count($highestRecordData) === 0) {
|
||||||
|
$typingExam->addHighestRecord($maestroID, $playerID, $writingID, $record);
|
||||||
|
$jsonBuilder->setData("highestRecord", "added");
|
||||||
|
} else {
|
||||||
|
if ($record > $highestRecordData["record"]) {
|
||||||
|
$typingExam->updateHighestRecord($highestRecordData["ID"], $record);
|
||||||
|
$jsonBuilder->setData("highestRecord", "updated");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$jsonBuilder->sendResultSuccess();
|
||||||
|
|
||||||
|
?>
|
||||||
+62
-1
@@ -1,3 +1,64 @@
|
|||||||
|
//////////////////////////////////////////////////
|
||||||
|
// typing exam DB
|
||||||
|
|
||||||
|
QUnit.test( "TypingExam", function( assert ) {
|
||||||
|
var dbService = new DBService();
|
||||||
|
dbService.setMaestroID(3); // 삼화초
|
||||||
|
dbService.setPlayerID(35); // 박지상
|
||||||
|
|
||||||
|
dbService.tddSetup(
|
||||||
|
"deleteTypingExamRecordAll",
|
||||||
|
(function(jsonData) { // onSucceeded
|
||||||
|
console.log(jsonData);
|
||||||
|
}).bind(this),
|
||||||
|
(function(jsonData) { // onFailed
|
||||||
|
console.log(jsonData);
|
||||||
|
}).bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
|
dbService.addPrevHourTypingExamRecord(
|
||||||
|
1, //writingRecord
|
||||||
|
120.35, // record
|
||||||
|
(function(jsonData) { // onSucceeded
|
||||||
|
console.log(jsonData);
|
||||||
|
}).bind(this),
|
||||||
|
(function(jsonData) { // onFailed
|
||||||
|
console.log(jsonData);
|
||||||
|
}).bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
|
dbService.updateTypingExamRecord(
|
||||||
|
1, //writingRecord
|
||||||
|
105.53, // record
|
||||||
|
(function(jsonData) { // onSucceeded
|
||||||
|
console.log(jsonData);
|
||||||
|
}).bind(this),
|
||||||
|
(function(jsonData) { // onFailed
|
||||||
|
console.log(jsonData);
|
||||||
|
}).bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
var done = assert.async();
|
||||||
|
setTimeout(function() {
|
||||||
|
dbService.getHighestRecord(
|
||||||
|
(function(jsonData) { // onSucceeded
|
||||||
|
console.log(jsonData);
|
||||||
|
|
||||||
|
var record = jsonData["highestRecord"];
|
||||||
|
assert.equal(record, 100, "highest record");
|
||||||
|
done();
|
||||||
|
}).bind(this),
|
||||||
|
(function(jsonData) { // onFailed
|
||||||
|
// console.log(jsonData);
|
||||||
|
done();
|
||||||
|
}).bind(this)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
// DBConnector
|
// DBConnector
|
||||||
|
|
||||||
@@ -10,7 +71,7 @@ QUnit.test( "DBConnector", function( assert ) {
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
dbService.requestWritingPlayerList(
|
dbService.requestWritingPlayerList(
|
||||||
(jsonData) => { // onSucceeded
|
(jsonData) => { // onSucceeded
|
||||||
console.log(jsonData);
|
// console.log(jsonData);
|
||||||
|
|
||||||
var writingArray = jsonData["writingArray"];
|
var writingArray = jsonData["writingArray"];
|
||||||
assert.equal(writingArray[0].name, "봄2", "name");
|
assert.equal(writingArray[0].name, "봄2", "name");
|
||||||
|
|||||||
Reference in New Issue
Block a user