Fix: HistoryRecord, record -> score

This commit is contained in:
2018-05-17 09:01:50 +09:00
parent bdd8316fb5
commit 0f623e954c
4 changed files with 95 additions and 37 deletions
+58
View File
@@ -0,0 +1,58 @@
class DBConnectManager {
constructor() {
}
requestMyHistory(appName) {
}
requestRankingHour(appName) {
}
requestRankingDay(appName) {
}
requestRankingMonth(appName) {
}
requestTempMyHistory() {
this.historyRecordManager.clear();
this.historyRecordManager.push(new HistoryRecordData("05/10", 15460));
this.historyRecordManager.push(new HistoryRecordData("05/11", 3040));
this.historyRecordManager.push(new HistoryRecordData("05/12", 460));
this.historyRecordManager.push(new HistoryRecordData("05/13", 60));
this.historyRecordManager.push(new HistoryRecordData("05/14", 8));
this.printHistoryRecords();
}
requestTempRanking() {
let jsonRankingList = [
{ "UserID":"17", "Name":"강경모", "BestRecord":"4400" },
{ "UserID":"2", "Name":"강성태", "BestRecord":"3400" },
{ "UserID":"3", "Name":"김기덕", "BestRecord":"2400" },
{ "UserID":"4", "Name":"김남희", "BestRecord":"1400" },
{ "UserID":"5", "Name":"고봉순", "BestRecord":"900" },
{ "UserID":"6", "Name":"파르마", "BestRecord":"800" },
{ "UserID":"1", "Name":"박지상", "BestRecord":"700" },
{ "UserID":"8", "Name":"신현주", "BestRecord":"600" },
{ "UserID":"9", "Name":"꼬봉이", "BestRecord":"500" },
{ "UserID":"10", "Name":"거북이", "BestRecord":"400" },
{ "UserID":"11", "Name":"다람쥐", "BestRecord":"300" },
{ "UserID":"12", "Name":"사시미", "BestRecord":"200" },
{ "UserID":"13", "Name":"태권도", "BestRecord":"100" },
{ "UserID":"14", "Name":"합기도", "BestRecord":"40" },
{ "UserID":"15", "Name":"우습지", "BestRecord":"10" },
{ "UserID":"16", "Name":"하하하", "BestRecord":"4" },
];
return jsonRankingList;
}
}
+11 -11
View File
@@ -1,8 +1,8 @@
class HistoryRecordData {
class HistoryRecord {
constructor(date, record) {
constructor(date, score) {
this.date = date;
this.record = record;
this.score = score;
}
}
@@ -14,8 +14,8 @@ class HistoryRecordManager {
this.clear();
}
push(historyRecordData) {
this.historyRecords.push(historyRecordData);
push(HistoryRecord) {
this.historyRecords.push(HistoryRecord);
this.minValueOfRecord = this.minValueOfArray();
this.maxValueOfRecord = this.maxValueOfArray();
@@ -40,17 +40,17 @@ class HistoryRecordManager {
return this.historyRecords[index].date;
}
getRecordAt(index) {
return this.historyRecords[index].record;
getScoreAt(index) {
return this.historyRecords[index].score;
}
minValueOfArray() {
let numberArray = this.getRecordArray(this.historyRecords);
let numberArray = this.getScoreArray(this.historyRecords);
return Math.min.apply(Math, numberArray);
}
maxValueOfArray() {
let numberArray = this.getRecordArray(this.historyRecords);
let numberArray = this.getScoreArray(this.historyRecords);
return Math.max.apply(Math, numberArray);
}
@@ -70,10 +70,10 @@ class HistoryRecordManager {
return underMaxValue;
}
getRecordArray() {
getScoreArray() {
let numberArray = [];
for(let data of this.historyRecords) {
numberArray.push(data.record);
numberArray.push(data.score);
}
return numberArray;
}