Add: typing exam start

This commit is contained in:
2019-07-18 16:23:07 +09:00
parent 1f6d91f301
commit f79040fed4
4 changed files with 71 additions and 37 deletions
+5 -1
View File
@@ -36,8 +36,12 @@ function TypingExamButton(x, y, iconName, buttonText, writingID) {
TypingExamButton.prototype.onClick = function() { TypingExamButton.prototype.onClick = function() {
sessionStorageManager.setPlayingAppID(200);
sessionStorageManager.setPlayingAppName("typing_exam");
sessionStorageManager.setPlayingAppKoreanName("타자검정");
sessionStorageManager.setWritingID(this.writingID); sessionStorageManager.setWritingID(this.writingID);
location.href = '../../web/client/typing_exam.html'; // location.href = '../../web/client/typing_exam.html';
location.href = '../../web/client/start.html';
// printSessionStorage(); // printSessionStorage();
} }
+10 -10
View File
@@ -200,15 +200,15 @@ DBConnectManager.prototype.requestTypingTestAppList = function(maestroID, player
xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID); xhr.send("maestro_id=" + maestroID + "&player_id=" + playerID);
} }
DBConnectManager.prototype.requestPlayerHistory = function(date, listener) { DBConnectManager.prototype.requestPlayerHistory = function(date, onSucceededListener, onFailedListener) {
var historyRecordManager = new HistoryRecordManager(); var historyRecordManager = new HistoryRecordManager();
/* /*
if(isDebugMode()) { if(isDebugMode()) {
this.loadTempPlayerHistory(historyRecordManager); this.loadTempPlayerHistory(historyRecordManager);
if(listener !== null) if(onSucceededListener !== null)
listener(historyRecordManager); onSucceededListener(historyRecordManager);
return; return;
} }
@@ -224,9 +224,9 @@ DBConnectManager.prototype.requestPlayerHistory = function(date, listener) {
var replyJSON = JSON.parse(xhr.responseText); var replyJSON = JSON.parse(xhr.responseText);
if(replyJSON != null) if(replyJSON != null)
listener(self.parseJSONtoHistoryRecord(replyJSON)); onSucceededListener(self.parseJSONtoHistoryRecord(replyJSON));
// else else
// onFailedListener(replyJSON); onFailedListener(replyJSON);
} }
}; };
var params = "MaestroID=" + sessionStorageManager.getMaestroID() var params = "MaestroID=" + sessionStorageManager.getMaestroID()
@@ -258,15 +258,15 @@ DBConnectManager.prototype.parseJSONtoHistoryRecord = function(json) {
return historyRecordManager; return historyRecordManager;
} }
DBConnectManager.prototype.requestRanking = function(type, maestroID, date, time, listener) { DBConnectManager.prototype.requestRanking = function(type, maestroID, date, time, onSucceededListener, onFailedListener) {
var rankingRecordManager = new RankingRecordManager(); var rankingRecordManager = new RankingRecordManager();
/* /*
if(isDebugMode()) { if(isDebugMode()) {
this.loadTempRanking(rankingRecordManager); this.loadTempRanking(rankingRecordManager);
if(listener !== null) if(onSucceededListener !== null)
listener(rankingRecordManager); onSucceededListener(rankingRecordManager);
return; return;
} }
@@ -282,7 +282,7 @@ DBConnectManager.prototype.requestRanking = function(type, maestroID, date, time
var replyJSON = JSON.parse(xhr.responseText); var replyJSON = JSON.parse(xhr.responseText);
if(replyJSON != null) { if(replyJSON != null) {
listener(type, self.parseJSONtoRankingRecord(type, replyJSON)); onSucceededListener(type, self.parseJSONtoRankingRecord(type, replyJSON));
} }
else else
onFailedListener(replyJSON); onFailedListener(replyJSON);
+31 -2
View File
@@ -7,6 +7,10 @@ var Start = {
create: function() { create: function() {
this.dbConnectManager = new DBConnectManager(); this.dbConnectManager = new DBConnectManager();
this.dbService = new DBService();
this.dbService.setMaestroID(sessionStorageManager.getMaestroID());
this.dbService.setPlayerID(sessionStorageManager.getPlayerID());
this.game.stage.backgroundColor = '#4d4d4d'; this.game.stage.backgroundColor = '#4d4d4d';
this.howToPlay = new HowToPlay(); this.howToPlay = new HowToPlay();
this.chart = new Chart(); this.chart = new Chart();
@@ -98,9 +102,36 @@ var Start = {
loadChart: function() { loadChart: function() {
var today = new Date(); var today = new Date();
var date = DateUtil.getYYYYMMDD(today); var date = DateUtil.getYYYYMMDD(today);
if(isTypingExamApp()) {
this.dbService.requestTypingExamPlayerHistory(
sessionStorageManager.getWritingID(),
date,
(function(historyRecordManager) {
this.onReceiveHistoryRecordManager(historyRecordManager);
}).bind(this),
(function(jsonData) {
console.log(jsonData);
}).bind(this)
);
} else {
this.dbConnectManager.requestPlayerHistory( this.dbConnectManager.requestPlayerHistory(
date, date,
(function(historyRecordManager) { (function(historyRecordManager) {
this.onReceiveHistoryRecordManager(historyRecordManager);
}).bind(this),
(function(jsonData) {
console.log(jsonData);
}).bind(this)
);
}
},
onReceiveHistoryRecordManager: function(historyRecordManager) {
if(historyRecordManager.count == 0) { if(historyRecordManager.count == 0) {
console.log("start - history record : no data"); console.log("start - history record : no data");
return; return;
@@ -127,8 +158,6 @@ var Start = {
} }
this.chart.printChartBaseLine(); this.chart.printChartBaseLine();
}).bind(this)
);
}, },
calcDate: function(daysBefore) { calcDate: function(daysBefore) {
+1
View File
@@ -33,6 +33,7 @@
<script src="../../game/lib/keyboard_shortcut.js"></script> <script src="../../game/lib/keyboard_shortcut.js"></script>
<script src="../../game/lib/history_record_manager.js"></script> <script src="../../game/lib/history_record_manager.js"></script>
<script src="../../game/lib/db_connect_manager.js"></script> <script src="../../game/lib/db_connect_manager.js"></script>
<script src="../../game/lib/db_service.js"></script>
<script src="../../game/lib/button/round_rect_button.js"></script> <script src="../../game/lib/button/round_rect_button.js"></script>
<script src="../../game/lib/button/back_button.js"></script> <script src="../../game/lib/button/back_button.js"></script>
<script src="../../game/lib/button/fullscreen_button.js"></script> <script src="../../game/lib/button/fullscreen_button.js"></script>