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);
+55 -26
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,37 +102,62 @@ var Start = {
loadChart: function() { loadChart: function() {
var today = new Date(); var today = new Date();
var date = DateUtil.getYYYYMMDD(today); var date = DateUtil.getYYYYMMDD(today);
this.dbConnectManager.requestPlayerHistory(
date,
(function(historyRecordManager) {
if(historyRecordManager.count == 0) {
console.log("start - history record : no data");
return;
}
var underValue = historyRecordManager.underValueForGraph(); if(isTypingExamApp()) {
var upperValue = historyRecordManager.upperValueForGraph(); this.dbService.requestTypingExamPlayerHistory(
sessionStorageManager.getWritingID(),
date,
var minValue = underValue - (upperValue - underValue) / 10; (function(historyRecordManager) {
var maxValue = upperValue;// + (upperValue - underValue) / 10; this.onReceiveHistoryRecordManager(historyRecordManager);
}).bind(this),
var countRecord = historyRecordManager.count; (function(jsonData) {
for(var i = 0; i < Chart.CHART_COUNT; i++) { console.log(jsonData);
// if(i > 6) }).bind(this)
// break; );
} else {
this.dbConnectManager.requestPlayerHistory(
date,
var historyRecord = historyRecordManager.getAt(i); (function(historyRecordManager) {
this.chart.drawRecordGraph( this.onReceiveHistoryRecordManager(historyRecordManager);
i, }).bind(this),
historyRecord === undefined ? "-" : historyRecord.date,
historyRecord === undefined ? "" : historyRecord.bestRecord,
minValue, maxValue
);
}
this.chart.printChartBaseLine(); (function(jsonData) {
}).bind(this) console.log(jsonData);
); }).bind(this)
);
}
},
onReceiveHistoryRecordManager: function(historyRecordManager) {
if(historyRecordManager.count == 0) {
console.log("start - history record : no data");
return;
}
var underValue = historyRecordManager.underValueForGraph();
var upperValue = historyRecordManager.upperValueForGraph();
var minValue = underValue - (upperValue - underValue) / 10;
var maxValue = upperValue;// + (upperValue - underValue) / 10;
var countRecord = historyRecordManager.count;
for(var i = 0; i < Chart.CHART_COUNT; i++) {
// if(i > 6)
// break;
var historyRecord = historyRecordManager.getAt(i);
this.chart.drawRecordGraph(
i,
historyRecord === undefined ? "-" : historyRecord.date,
historyRecord === undefined ? "" : historyRecord.bestRecord,
minValue, maxValue
);
}
this.chart.printChartBaseLine();
}, },
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>