Fix: show failed record in result, ranking
This commit is contained in:
@@ -22,8 +22,11 @@ Chart.prototype.drawRecordGraph = function(index, date, bestRecord, min, max) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var recordTextPosY = posY - Chart.CHART_HEIGHT - Chart.CHART_RECORD_OFFSET_Y;
|
var recordTextPosY = posY - Chart.CHART_HEIGHT - Chart.CHART_RECORD_OFFSET_Y;
|
||||||
var absRecordValue = Math.abs(bestRecord);
|
// var absRecordValue = Math.abs(bestRecord);
|
||||||
|
var absRecordValue = bestRecord < 0 ? -1 * bestRecord : bestRecord;
|
||||||
|
// var absRecordValue = Math.abs(Math.floor(bestRecord));
|
||||||
var recordWithUnit = RecordUtil.getRecordValueWithUnit(absRecordValue, sessionStorageManager.getPlayingAppID());
|
var recordWithUnit = RecordUtil.getRecordValueWithUnit(absRecordValue, sessionStorageManager.getPlayingAppID());
|
||||||
|
|
||||||
if(bestRecord >= 0) {
|
if(bestRecord >= 0) {
|
||||||
this.drawText(posX, recordTextPosY, recordWithUnit);
|
this.drawText(posX, recordTextPosY, recordWithUnit);
|
||||||
} else {
|
} else {
|
||||||
@@ -38,9 +41,14 @@ Chart.prototype.drawRecordGraph = function(index, date, bestRecord, min, max) {
|
|||||||
chartColor = 0xdddddd;
|
chartColor = 0xdddddd;
|
||||||
else
|
else
|
||||||
chartColor = 0xffaaaa;
|
chartColor = 0xffaaaa;
|
||||||
|
if(max < absRecordValue)
|
||||||
|
max = absRecordValue * 1.1;
|
||||||
this.chartGraphics.lineStyle(50, chartColor, 1);
|
this.chartGraphics.lineStyle(50, chartColor, 1);
|
||||||
this.chartGraphics.moveTo(posX, posY);
|
this.chartGraphics.moveTo(posX, posY);
|
||||||
this.chartGraphics.lineTo(posX, posY - Chart.CHART_HEIGHT * ( (absRecordValue - min) / (max - min) ));
|
this.chartGraphics.lineTo(posX, posY - Chart.CHART_HEIGHT * ( (absRecordValue - min) / (max - min) ));
|
||||||
|
console.log("absRecordValue : " + absRecordValue);
|
||||||
|
console.log("min : " + min);
|
||||||
|
console.log("max : " + max);
|
||||||
}
|
}
|
||||||
|
|
||||||
Chart.prototype.drawText = function(posX, posY, text) {
|
Chart.prototype.drawText = function(posX, posY, text) {
|
||||||
|
|||||||
@@ -361,20 +361,24 @@ DBService.prototype.parseJSONtoRankingRecord = function(type, jsonData) {
|
|||||||
return rankingRecordManager;
|
return rankingRecordManager;
|
||||||
|
|
||||||
var replyJSON = null;
|
var replyJSON = null;
|
||||||
|
var rankingMinusJSON = null;
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case DBConnectManager.TYPE_MY_RANKING_HOUR:
|
case DBConnectManager.TYPE_MY_RANKING_HOUR:
|
||||||
case DBConnectManager.TYPE_ALL_RANKING_HOUR:
|
case DBConnectManager.TYPE_ALL_RANKING_HOUR:
|
||||||
replyJSON = jsonData.rankingHour;
|
replyJSON = jsonData.rankingHour;
|
||||||
|
rankingMinusJSON = jsonData.rankingMinusHour;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DBConnectManager.TYPE_MY_RANKING_DAY:
|
case DBConnectManager.TYPE_MY_RANKING_DAY:
|
||||||
case DBConnectManager.TYPE_ALL_RANKING_DAY:
|
case DBConnectManager.TYPE_ALL_RANKING_DAY:
|
||||||
replyJSON = jsonData.rankingDay;
|
replyJSON = jsonData.rankingDay;
|
||||||
|
rankingMinusJSON = jsonData.rankingMinusDay;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DBConnectManager.TYPE_MY_RANKING_MONTH:
|
case DBConnectManager.TYPE_MY_RANKING_MONTH:
|
||||||
case DBConnectManager.TYPE_ALL_RANKING_MONTH:
|
case DBConnectManager.TYPE_ALL_RANKING_MONTH:
|
||||||
replyJSON = jsonData.rankingMonth;
|
replyJSON = jsonData.rankingMonth;
|
||||||
|
rankingMinusJSON = jsonData.rankingMinusMonth;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -392,6 +396,24 @@ DBService.prototype.parseJSONtoRankingRecord = function(type, jsonData) {
|
|||||||
rankingRecordManager.push(record);
|
rankingRecordManager.push(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(rankingMinusJSON === null)
|
||||||
|
return rankingRecordManager;
|
||||||
|
|
||||||
|
var countMinus = rankingMinusJSON.length;
|
||||||
|
for(var i = 0; i < countMinus; i++) {
|
||||||
|
if(rankingRecordManager.hasPlayerID(rankingMinusJSON[i]["PlayerID"]))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var record = new RankingRecord(
|
||||||
|
// i + 1,
|
||||||
|
-1,
|
||||||
|
rankingMinusJSON[i]["PlayerID"],
|
||||||
|
rankingMinusJSON[i]["Name"],
|
||||||
|
rankingMinusJSON[i]["HighScore"]
|
||||||
|
);
|
||||||
|
rankingRecordManager.push(record);
|
||||||
|
}
|
||||||
|
|
||||||
return rankingRecordManager;
|
return rankingRecordManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ HistoryRecordManager.prototype.maxValueOfArray = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HistoryRecordManager.prototype.underValueForGraph = function() {
|
HistoryRecordManager.prototype.underValueForGraph = function() {
|
||||||
console.log("this.minValueOfRecord : " + this.minValueOfRecord);
|
// console.log("this.minValueOfRecord : " + this.minValueOfRecord);
|
||||||
var minNumberOfDigits = NumberUtil.numberOfDigits(this.minValueOfRecord);
|
var minNumberOfDigits = NumberUtil.numberOfDigits(this.minValueOfRecord);
|
||||||
var underMinValue =
|
var underMinValue =
|
||||||
Math.floor( (this.minValueOfRecord / Math.pow(10, minNumberOfDigits - 2) ) )
|
Math.floor( (this.minValueOfRecord / Math.pow(10, minNumberOfDigits - 2) ) )
|
||||||
|
|||||||
@@ -56,3 +56,13 @@ RankingRecordManager.prototype.getBestRecordAt = function(index) {
|
|||||||
|
|
||||||
return this.rankingRecords[index].bestRecord;
|
return this.rankingRecords[index].bestRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RankingRecordManager.prototype.hasPlayerID = function(playerID) {
|
||||||
|
var count = this.rankingRecords.length;
|
||||||
|
for(var i = 0; i < count; i++) {
|
||||||
|
if(this.getPlayerIDAt(i) == playerID)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
@@ -42,7 +42,18 @@ HistoryText.prototype.setContents = function(date, record) {
|
|||||||
this.reset();
|
this.reset();
|
||||||
|
|
||||||
this.textDate.text = DateUtil.printMonthDay(date);
|
this.textDate.text = DateUtil.printMonthDay(date);
|
||||||
this.textRecord.text = RecordUtil.getRecordValueWithUnit(record, sessionStorageManager.getPlayingAppID());
|
|
||||||
|
var recordValue = record >= 0 ? record : -1 * record;
|
||||||
|
var absRecordValue = RecordUtil.getRecordValueWithUnit(
|
||||||
|
recordValue,
|
||||||
|
sessionStorageManager.getPlayingAppID()
|
||||||
|
);
|
||||||
|
if(record >= 0) {
|
||||||
|
this.textRecord.text = absRecordValue;
|
||||||
|
} else {
|
||||||
|
this.textRecord.text = "실격/" + absRecordValue;
|
||||||
|
this.textRecord.style.fill = "#ffaaaa";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,8 @@ RankingText.prototype.setTextRankingColor = function(text, ranking) {
|
|||||||
}
|
}
|
||||||
text.fill = fillColor;
|
text.fill = fillColor;
|
||||||
text.stroke = strokeColor;
|
text.stroke = strokeColor;
|
||||||
text.strokeThickness = 2;
|
text.strokeThickness = 6;
|
||||||
|
text.setShadow(2, 2, "#333333", 2, false, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
RankingText.prototype.setTopRankingTextColor = function(ranking) {
|
RankingText.prototype.setTopRankingTextColor = function(ranking) {
|
||||||
@@ -131,19 +132,48 @@ RankingText.prototype.setMyRankingTextColor = function() {
|
|||||||
this.textRecord.strokeThickness = 2;
|
this.textRecord.strokeThickness = 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
RankingText.prototype.setRankingMinusTextColor = function(ranking) {
|
||||||
|
// console.log(ranking);
|
||||||
|
if(ranking >= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var fillColor = "#ddaaaa"; // yellowgreen
|
||||||
|
// var strokeColor = "#2e8b57"; // seagreen
|
||||||
|
this.textRanking.fill = fillColor;
|
||||||
|
// this.textRanking.stroke = strokeColor;
|
||||||
|
// this.textRanking.strokeThickness = 2;
|
||||||
|
this.textPlayerName.fill = fillColor;
|
||||||
|
// this.textPlayerName.stroke = strokeColor;
|
||||||
|
// this.textPlayerName.strokeThickness = 2;
|
||||||
|
this.textRecord.fill = fillColor;
|
||||||
|
// this.textRecord.stroke = strokeColor;
|
||||||
|
// this.textRecord.strokeThickness = 2;
|
||||||
|
};
|
||||||
|
|
||||||
RankingText.prototype.setContents = function(playerID, ranking, playerName, record) {
|
RankingText.prototype.setContents = function(playerID, ranking, playerName, record) {
|
||||||
this.reset();
|
this.reset();
|
||||||
|
|
||||||
this.playerID = playerID;
|
this.playerID = playerID;
|
||||||
|
if(record >= 0)
|
||||||
this.textRanking.text = ranking + "등";
|
this.textRanking.text = ranking + "등";
|
||||||
|
else
|
||||||
|
this.textRanking.text = "실격";
|
||||||
this.textPlayerName.text = playerName;
|
this.textPlayerName.text = playerName;
|
||||||
this.setRecord(record, this.appID);
|
this.setRecord(record, this.appID);
|
||||||
this.setMyRankingTextColor();
|
|
||||||
this.setTopRankingTextColor(ranking);
|
this.setTopRankingTextColor(ranking);
|
||||||
|
this.setRankingMinusTextColor(ranking);
|
||||||
|
this.setMyRankingTextColor();
|
||||||
};
|
};
|
||||||
|
|
||||||
RankingText.prototype.setRecord = function(record, appID) {
|
RankingText.prototype.setRecord = function(record, appID) {
|
||||||
this.textRecord.text = RecordUtil.getRecordValueWithUnit(record, appID);
|
// this.textRecord.text = RecordUtil.getRecordValueWithUnit(record, appID);
|
||||||
|
|
||||||
|
var recordValue = record >= 0 ? record : -1 * record;
|
||||||
|
var absRecordValue = RecordUtil.getRecordValueWithUnit(
|
||||||
|
recordValue,
|
||||||
|
sessionStorageManager.getPlayingAppID()
|
||||||
|
);
|
||||||
|
this.textRecord.text = absRecordValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -413,10 +413,11 @@ var Ranking = {
|
|||||||
var record = [];
|
var record = [];
|
||||||
// record[0] = jsonRankingList[i]['UserID'];
|
// record[0] = jsonRankingList[i]['UserID'];
|
||||||
record[0] = rankingRecordManager.getPlayerIDAt(i); // playerID
|
record[0] = rankingRecordManager.getPlayerIDAt(i); // playerID
|
||||||
record[1] = i + 1; // ranking
|
// record[1] = i + 1; // ranking
|
||||||
|
record[1] = rankingRecordManager.getRankAt(i);; // ranking
|
||||||
record[2] = rankingRecordManager.getPlayerNameAt(i);
|
record[2] = rankingRecordManager.getPlayerNameAt(i);
|
||||||
record[3] = rankingRecordManager.getBestRecordAt(i);
|
record[3] = rankingRecordManager.getBestRecordAt(i);
|
||||||
// console.log("record : " + record[0] + ", " + record[1] + ", " + record[2]);
|
// console.log("record : " + record[0] + ", " + record[1] + ", " + record[2] + ", " + record[3]);
|
||||||
|
|
||||||
this.recordArray.push(record);
|
this.recordArray.push(record);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ RankingBoard.prototype.requestRanking = function(type) {
|
|||||||
|
|
||||||
RankingBoard.prototype.onReceiveRankingData = function(type, rankingRecordManager) {
|
RankingBoard.prototype.onReceiveRankingData = function(type, rankingRecordManager) {
|
||||||
if(rankingRecordManager.getCount() == 0) {
|
if(rankingRecordManager.getCount() == 0) {
|
||||||
console.log("ranking board - no data");
|
// console.log("ranking board - no data");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ Result.prototype.printRecord = function() {
|
|||||||
scoreText.style.fill = MainColor.THISTLE_STRING;
|
scoreText.style.fill = MainColor.THISTLE_STRING;
|
||||||
|
|
||||||
var timeoverText = this.makeDefaultText(game.world.width / 2, 225);
|
var timeoverText = this.makeDefaultText(game.world.width / 2, 225);
|
||||||
timeoverText.text = "== 제한 시간 초과 (기록 저장 안됨) ==";
|
timeoverText.text = "== 제한 시간 초과 ==";
|
||||||
timeoverText.fontSize = 50;
|
timeoverText.fontSize = 50;
|
||||||
timeoverText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
timeoverText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||||
timeoverText.anchor.set(0.5);
|
timeoverText.anchor.set(0.5);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ var Start = {
|
|||||||
sessionStorageManager.getWritingID(),
|
sessionStorageManager.getWritingID(),
|
||||||
|
|
||||||
(function(replyJSON) {
|
(function(replyJSON) {
|
||||||
console.log(replyJSON);
|
// console.log(replyJSON);
|
||||||
var highestRecordData = replyJSON["highestRecordData"];
|
var highestRecordData = replyJSON["highestRecordData"];
|
||||||
var highestRecord = highestRecordData["highestRecord"];
|
var highestRecord = highestRecordData["highestRecord"];
|
||||||
this.onReceiveAppHighestRecord(highestRecord);
|
this.onReceiveAppHighestRecord(highestRecord);
|
||||||
@@ -168,8 +168,8 @@ var Start = {
|
|||||||
|
|
||||||
var underValue = historyRecordManager.underValueForGraph();
|
var underValue = historyRecordManager.underValueForGraph();
|
||||||
var upperValue = historyRecordManager.upperValueForGraph();
|
var upperValue = historyRecordManager.upperValueForGraph();
|
||||||
console.log("underValue : " + underValue);
|
// console.log("underValue : " + underValue);
|
||||||
console.log("upperValue : " + upperValue);
|
// console.log("upperValue : " + upperValue);
|
||||||
|
|
||||||
var minValue = underValue - (upperValue - underValue) / 10;
|
var minValue = underValue - (upperValue - underValue) / 10;
|
||||||
var maxValue = upperValue;// + (upperValue - underValue) / 10;
|
var maxValue = upperValue;// + (upperValue - underValue) / 10;
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ class TypingExamCollection extends DBMethodContainer
|
|||||||
$query = "
|
$query = "
|
||||||
SELECT TER.playerID As PlayerID, U.Name AS Name, MAX(TER.Record) AS HighScore
|
SELECT TER.playerID As PlayerID, U.Name AS Name, MAX(TER.Record) AS HighScore
|
||||||
FROM typing_exam_record TER, player U
|
FROM typing_exam_record TER, player U
|
||||||
WHERE TER.MaestroID = ? AND TER.playerID = U.playerID AND YEAR(TER.RecordDateTime) = YEAR(?) AND MONTH(TER.RecordDateTime) = MONTH(?) AND DAYOFMONTH(TER.RecordDateTime) = DAYOFMONTH(?) AND HOUR(TER.RecordDateTime) = HOUR(?) AND TER.WritingID = ?
|
WHERE TER.MaestroID = ? AND TER.playerID = U.playerID AND YEAR(TER.RecordDateTime) = YEAR(?) AND MONTH(TER.RecordDateTime) = MONTH(?) AND DAYOFMONTH(TER.RecordDateTime) = DAYOFMONTH(?) AND HOUR(TER.RecordDateTime) = HOUR(?) AND TER.WritingID = ? AND TER.Record >= 0
|
||||||
GROUP BY TER.playerID
|
GROUP BY TER.playerID
|
||||||
ORDER BY MAX(TER.Record) DESC;
|
ORDER BY MAX(TER.Record) DESC;
|
||||||
";
|
";
|
||||||
@@ -215,7 +215,7 @@ class TypingExamCollection extends DBMethodContainer
|
|||||||
$query = "
|
$query = "
|
||||||
SELECT TER.playerID As PlayerID, U.Name AS Name, MAX(TER.Record) AS HighScore
|
SELECT TER.playerID As PlayerID, U.Name AS Name, MAX(TER.Record) AS HighScore
|
||||||
FROM typing_exam_record TER, player U
|
FROM typing_exam_record TER, player U
|
||||||
WHERE TER.MaestroID = ? AND TER.playerID = U.playerID AND YEAR(TER.RecordDateTime) = YEAR(?) AND MONTH(TER.RecordDateTime) = MONTH(?) AND DAYOFMONTH(TER.RecordDateTime) = DAYOFMONTH(?) AND TER.WritingID = ?
|
WHERE TER.MaestroID = ? AND TER.playerID = U.playerID AND YEAR(TER.RecordDateTime) = YEAR(?) AND MONTH(TER.RecordDateTime) = MONTH(?) AND DAYOFMONTH(TER.RecordDateTime) = DAYOFMONTH(?) AND TER.WritingID = ? AND TER.Record >= 0
|
||||||
GROUP BY TER.playerID
|
GROUP BY TER.playerID
|
||||||
ORDER BY MAX(TER.Record) DESC;
|
ORDER BY MAX(TER.Record) DESC;
|
||||||
";
|
";
|
||||||
@@ -240,7 +240,7 @@ class TypingExamCollection extends DBMethodContainer
|
|||||||
$query = "
|
$query = "
|
||||||
SELECT TER.playerID As PlayerID, U.Name AS Name, MAX(TER.Record) AS HighScore
|
SELECT TER.playerID As PlayerID, U.Name AS Name, MAX(TER.Record) AS HighScore
|
||||||
FROM typing_exam_record TER, player U
|
FROM typing_exam_record TER, player U
|
||||||
WHERE TER.MaestroID = ? AND TER.playerID = U.playerID AND YEAR(TER.RecordDateTime) = YEAR(?) AND MONTH(TER.RecordDateTime) = MONTH(?) AND TER.WritingID = ?
|
WHERE TER.MaestroID = ? AND TER.playerID = U.playerID AND YEAR(TER.RecordDateTime) = YEAR(?) AND MONTH(TER.RecordDateTime) = MONTH(?) AND TER.WritingID = ? AND TER.Record >= 0
|
||||||
GROUP BY TER.playerID
|
GROUP BY TER.playerID
|
||||||
ORDER BY MAX(TER.Record) DESC;
|
ORDER BY MAX(TER.Record) DESC;
|
||||||
";
|
";
|
||||||
@@ -260,5 +260,80 @@ class TypingExamCollection extends DBMethodContainer
|
|||||||
|
|
||||||
return $rankingRecordArray;
|
return $rankingRecordArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getRankingMinusRecordHour($maestroID, $writingID, $date, $time) {
|
||||||
|
$query = "
|
||||||
|
SELECT TER.playerID As PlayerID, U.Name AS Name, MAX(TER.Record) AS HighScore
|
||||||
|
FROM typing_exam_record TER, player U
|
||||||
|
WHERE TER.MaestroID = ? AND TER.playerID = U.playerID AND YEAR(TER.RecordDateTime) = YEAR(?) AND MONTH(TER.RecordDateTime) = MONTH(?) AND DAYOFMONTH(TER.RecordDateTime) = DAYOFMONTH(?) AND HOUR(TER.RecordDateTime) = HOUR(?) AND TER.WritingID = ? AND TER.Record < 0
|
||||||
|
GROUP BY TER.playerID
|
||||||
|
ORDER BY MAX(TER.Record) ASC;
|
||||||
|
";
|
||||||
|
$stmt = $this->mysqli->prepare($query);
|
||||||
|
$stmt->bind_param('issssi', $maestroID, $date, $date, $date, $time, $writingID);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($playerID, $name, $highScore);
|
||||||
|
|
||||||
|
$rankingRecordArray = array();
|
||||||
|
while($stmt->fetch()) {
|
||||||
|
$rankingRecord['PlayerID'] = $playerID;
|
||||||
|
$rankingRecord['Name'] = $name;
|
||||||
|
$rankingRecord['HighScore'] = $highScore;
|
||||||
|
array_push($rankingRecordArray, $rankingRecord);
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
return $rankingRecordArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRankingMinusRecordDay($maestroID, $writingID, $date) {
|
||||||
|
$query = "
|
||||||
|
SELECT TER.playerID As PlayerID, U.Name AS Name, MAX(TER.Record) AS HighScore
|
||||||
|
FROM typing_exam_record TER, player U
|
||||||
|
WHERE TER.MaestroID = ? AND TER.playerID = U.playerID AND YEAR(TER.RecordDateTime) = YEAR(?) AND MONTH(TER.RecordDateTime) = MONTH(?) AND DAYOFMONTH(TER.RecordDateTime) = DAYOFMONTH(?) AND TER.WritingID = ? AND TER.Record < 0
|
||||||
|
GROUP BY TER.playerID
|
||||||
|
ORDER BY MAX(TER.Record) ASC;
|
||||||
|
";
|
||||||
|
$stmt = $this->mysqli->prepare($query);
|
||||||
|
$stmt->bind_param('isssi', $maestroID, $date, $date, $date, $writingID);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($playerID, $name, $highScore);
|
||||||
|
|
||||||
|
$rankingRecordArray = array();
|
||||||
|
while($stmt->fetch()) {
|
||||||
|
$rankingRecord['PlayerID'] = $playerID;
|
||||||
|
$rankingRecord['Name'] = $name;
|
||||||
|
$rankingRecord['HighScore'] = $highScore;
|
||||||
|
array_push($rankingRecordArray, $rankingRecord);
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
return $rankingRecordArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getRankingMinusRecordMonth($maestroID, $writingID, $date) {
|
||||||
|
$query = "
|
||||||
|
SELECT TER.playerID As PlayerID, U.Name AS Name, MAX(TER.Record) AS HighScore
|
||||||
|
FROM typing_exam_record TER, player U
|
||||||
|
WHERE TER.MaestroID = ? AND TER.playerID = U.playerID AND YEAR(TER.RecordDateTime) = YEAR(?) AND MONTH(TER.RecordDateTime) = MONTH(?) AND TER.WritingID = ? AND TER.Record < 0
|
||||||
|
GROUP BY TER.playerID
|
||||||
|
ORDER BY MAX(TER.Record) ASC;
|
||||||
|
";
|
||||||
|
$stmt = $this->mysqli->prepare($query);
|
||||||
|
$stmt->bind_param('issi', $maestroID, $date, $date, $writingID);
|
||||||
|
$stmt->execute();
|
||||||
|
$stmt->bind_result($playerID, $name, $highScore);
|
||||||
|
|
||||||
|
$rankingRecordArray = array();
|
||||||
|
while($stmt->fetch()) {
|
||||||
|
$rankingRecord['PlayerID'] = $playerID;
|
||||||
|
$rankingRecord['Name'] = $name;
|
||||||
|
$rankingRecord['HighScore'] = $highScore;
|
||||||
|
array_push($rankingRecordArray, $rankingRecord);
|
||||||
|
}
|
||||||
|
$stmt->close();
|
||||||
|
|
||||||
|
return $rankingRecordArray;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -28,6 +28,8 @@ $typingExam = new TypingExamCollection($dbConnector->getMysqli());
|
|||||||
|
|
||||||
$rankingRecordArray = $typingExam->getRankingRecordDay($maestroID, $writingID, $date);
|
$rankingRecordArray = $typingExam->getRankingRecordDay($maestroID, $writingID, $date);
|
||||||
$jsonBuilder->setData("rankingDay", $rankingRecordArray);
|
$jsonBuilder->setData("rankingDay", $rankingRecordArray);
|
||||||
|
$rankingMinusRecordArray = $typingExam->getRankingMinusRecordDay($maestroID, $writingID, $date);
|
||||||
|
$jsonBuilder->setData("rankingMinusDay", $rankingMinusRecordArray);
|
||||||
|
|
||||||
if ($rankingRecordArray === null) {
|
if ($rankingRecordArray === null) {
|
||||||
$jsonBuilder->sendResultFail();
|
$jsonBuilder->sendResultFail();
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ $typingExam = new TypingExamCollection($dbConnector->getMysqli());
|
|||||||
|
|
||||||
$rankingRecordArray = $typingExam->getRankingRecordHour($maestroID, $writingID, $date, $time);
|
$rankingRecordArray = $typingExam->getRankingRecordHour($maestroID, $writingID, $date, $time);
|
||||||
$jsonBuilder->setData("rankingHour", $rankingRecordArray);
|
$jsonBuilder->setData("rankingHour", $rankingRecordArray);
|
||||||
|
$rankingMinusRecordArray = $typingExam->getRankingMinusRecordHour($maestroID, $writingID, $date, $time);
|
||||||
|
$jsonBuilder->setData("rankingMinusHour", $rankingMinusRecordArray);
|
||||||
|
|
||||||
if ($rankingRecordArray === null) {
|
if ($rankingRecordArray === null) {
|
||||||
$jsonBuilder->sendResultFail();
|
$jsonBuilder->sendResultFail();
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ $typingExam = new TypingExamCollection($dbConnector->getMysqli());
|
|||||||
|
|
||||||
$rankingRecordArray = $typingExam->getRankingRecordMonth($maestroID, $writingID, $date);
|
$rankingRecordArray = $typingExam->getRankingRecordMonth($maestroID, $writingID, $date);
|
||||||
$jsonBuilder->setData("rankingMonth", $rankingRecordArray);
|
$jsonBuilder->setData("rankingMonth", $rankingRecordArray);
|
||||||
|
$rankingMinusRecordArray = $typingExam->getRankingMinusRecordMonth($maestroID, $writingID, $date);
|
||||||
|
$jsonBuilder->setData("rankingMinusMonth", $rankingMinusRecordArray);
|
||||||
|
|
||||||
if ($rankingRecordArray === null) {
|
if ($rankingRecordArray === null) {
|
||||||
$jsonBuilder->sendResultFail();
|
$jsonBuilder->sendResultFail();
|
||||||
|
|||||||
Reference in New Issue
Block a user