Add: regist minus record for typing exam
This commit is contained in:
+154
-1
@@ -93,7 +93,7 @@ QUnit.test( "AppList", function( assert ) {
|
||||
(function(jsonData) {
|
||||
assert.equal(jsonData.appGroup, appGroup, "#0 appGroup : typing practice, English");
|
||||
assert.equal(jsonData.appData.appList.length, 7, "appList");
|
||||
assert.equal(jsonData.appData.activeAppList.length, 5, "activeAppList");
|
||||
assert.equal(jsonData.appData.activeAppList.length, 6, "activeAppList");
|
||||
assert.equal(jsonData.appData.highestRecordList.length, 7, "highestRecordList");
|
||||
asyncTypingPracticeEnglish();
|
||||
}).bind(this),
|
||||
@@ -462,6 +462,159 @@ QUnit.test( "TypingExamDB", function( assert ) {
|
||||
});
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// typing exam DB - minus record
|
||||
|
||||
QUnit.test( "TypingExamDB - minus record", function( assert ) {
|
||||
var MAESTRO_ID = 3; // 삼화초
|
||||
var PLAYER_ID = 35; // 박지상
|
||||
var WRITING_ID = 1;
|
||||
var RECORD = -117.89;
|
||||
|
||||
var dbService = new DBService();
|
||||
dbService.setMaestroID(MAESTRO_ID);
|
||||
dbService.setPlayerID(PLAYER_ID);
|
||||
|
||||
dbService.tddSetup(
|
||||
"deleteWritingRecordAll",
|
||||
(function(jsonData) { // onSucceeded
|
||||
// console.log(jsonData);
|
||||
addPrevHourTypingExamRecord();
|
||||
}).bind(this),
|
||||
(function(jsonData) { // onFailed
|
||||
// console.log(jsonData);
|
||||
}).bind(this)
|
||||
);
|
||||
|
||||
function addPrevHourTypingExamRecord()
|
||||
{
|
||||
console.log("record : " + RECORD);
|
||||
dbService.addPrevHourTypingExamRecord(
|
||||
WRITING_ID, //writingRecord
|
||||
RECORD, // record : -117.89
|
||||
(function(jsonData) { // onSucceeded
|
||||
// console.log(jsonData);
|
||||
updateTypingExamRecord();
|
||||
}).bind(this),
|
||||
(function(jsonData) { // onFailed
|
||||
// console.log(jsonData);
|
||||
}).bind(this)
|
||||
);
|
||||
}
|
||||
|
||||
// add this hour record + 10
|
||||
function updateTypingExamRecord()
|
||||
{
|
||||
console.log("record : " + (RECORD + 20));
|
||||
dbService.updateTypingExamRecord(
|
||||
WRITING_ID, //writingRecord
|
||||
RECORD + 20, // record
|
||||
(function(jsonData) { // onSucceeded
|
||||
// console.log(jsonData);
|
||||
updateTypingExamRecord2();
|
||||
|
||||
// getTypingExamRecord();
|
||||
}).bind(this),
|
||||
(function(jsonData) { // onFailed
|
||||
// console.log(jsonData);
|
||||
}).bind(this)
|
||||
);
|
||||
}
|
||||
|
||||
// update this hour record
|
||||
function updateTypingExamRecord2()
|
||||
{
|
||||
dbService.updateTypingExamRecord(
|
||||
WRITING_ID, //writingRecord
|
||||
RECORD, // record
|
||||
(function(jsonData) { // onSucceeded
|
||||
// console.log(jsonData);
|
||||
getTypingExamHighestRecord();
|
||||
}).bind(this),
|
||||
(function(jsonData) { // onFailed
|
||||
// console.log(jsonData);
|
||||
}).bind(this)
|
||||
);
|
||||
}
|
||||
|
||||
var done = assert.async();
|
||||
function getTypingExamRecord() {
|
||||
setTimeout(function() {
|
||||
dbService.getTypingExamHighestRecord(
|
||||
WRITING_ID,
|
||||
(function(jsonData) { // onSucceeded
|
||||
// console.log(jsonData);
|
||||
|
||||
var highestRecord = jsonData["highestRecordData"];
|
||||
assert.equal(highestRecord["highestRecord"], 0, "highest record");
|
||||
updateTypingExamRecord3();
|
||||
}).bind(this),
|
||||
(function(jsonData) { // onFailed
|
||||
// console.log(jsonData);
|
||||
done();
|
||||
}).bind(this)
|
||||
);
|
||||
});
|
||||
}
|
||||
function getTypingExamHighestRecord()
|
||||
{
|
||||
setTimeout(function() {
|
||||
dbService.getTypingExamHighestRecord(
|
||||
WRITING_ID,
|
||||
(function(jsonData) { // onSucceeded
|
||||
// console.log(jsonData);
|
||||
|
||||
var highestRecord = jsonData["highestRecordData"];
|
||||
assert.equal(highestRecord["highestRecord"], null, "highest record");
|
||||
updateTypingExamRecord3();
|
||||
}).bind(this),
|
||||
(function(jsonData) { // onFailed
|
||||
// console.log(jsonData);
|
||||
done();
|
||||
}).bind(this)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// update this hour record
|
||||
function updateTypingExamRecord3()
|
||||
{
|
||||
console.log("record : " + (RECORD - 10));
|
||||
dbService.updateTypingExamRecord(
|
||||
WRITING_ID, //writingRecord
|
||||
RECORD - 10, // record
|
||||
(function(jsonData) { // onSucceeded
|
||||
// console.log(jsonData);
|
||||
getTypingExamHighestRecord2();
|
||||
}).bind(this),
|
||||
(function(jsonData) { // onFailed
|
||||
// console.log(jsonData);
|
||||
done();
|
||||
}).bind(this)
|
||||
);
|
||||
}
|
||||
|
||||
function getTypingExamHighestRecord2()
|
||||
{
|
||||
dbService.getTypingExamHighestRecord(
|
||||
WRITING_ID,
|
||||
(function(jsonData) { // onSucceeded
|
||||
// console.log(jsonData);
|
||||
|
||||
var highestRecord = jsonData["highestRecordData"];
|
||||
assert.equal(highestRecord["highestRecord"], null, "highest record");
|
||||
done();
|
||||
}).bind(this),
|
||||
(function(jsonData) { // onFailed
|
||||
// console.log(jsonData);
|
||||
done();
|
||||
}).bind(this)
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// DBConnector
|
||||
|
||||
|
||||
Reference in New Issue
Block a user