Fix: change score -> record, bestRecord
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
class HistoryRecord {
|
||||
|
||||
constructor(date, appName, score) {
|
||||
constructor(date, appName, bestRecord) {
|
||||
this.date = date;
|
||||
this.appName = appName;
|
||||
this.score = score;
|
||||
this.bestRecord = bestRecord;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,17 +45,17 @@ class HistoryRecordManager {
|
||||
return this.historyRecords[index].appName;
|
||||
}
|
||||
|
||||
getScoreAt(index) {
|
||||
return this.historyRecords[index].score;
|
||||
getBestRecordAt(index) {
|
||||
return this.historyRecords[index].bestRecord;
|
||||
}
|
||||
|
||||
minValueOfArray() {
|
||||
let numberArray = this.getScoreArray(this.historyRecords);
|
||||
let numberArray = this.getBestRecordArray(this.historyRecords);
|
||||
return Math.min.apply(Math, numberArray);
|
||||
}
|
||||
|
||||
maxValueOfArray() {
|
||||
let numberArray = this.getScoreArray(this.historyRecords);
|
||||
let numberArray = this.getBestRecordArray(this.historyRecords);
|
||||
return Math.max.apply(Math, numberArray);
|
||||
}
|
||||
|
||||
@@ -75,10 +75,10 @@ class HistoryRecordManager {
|
||||
return underMaxValue;
|
||||
}
|
||||
|
||||
getScoreArray() {
|
||||
getBestRecordArray() {
|
||||
let numberArray = [];
|
||||
for(let data of this.historyRecords) {
|
||||
numberArray.push(data.score);
|
||||
numberArray.push(data.bestRecord);
|
||||
}
|
||||
return numberArray;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ class NumberUtil {
|
||||
return Math.floor(Math.log(number) / Math.LN10 + 1); // bug : 1000 -> expected 4 but 3
|
||||
}
|
||||
|
||||
static getScoreText(value) {
|
||||
static getRecordText(value) {
|
||||
let number = Math.floor(value);
|
||||
let numberWithCommas = NumberUtil.numberWithCommas(number);
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
class RankingRecord {
|
||||
|
||||
constructor(rank, userID, userName, score) {
|
||||
constructor(rank, userID, userName, bestRecord) {
|
||||
this.rank = rank;
|
||||
this.userID = userID;
|
||||
this.userName = userName;
|
||||
this.score = score;
|
||||
this.bestRecord = bestRecord;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ class RankingRecordManager {
|
||||
return this.rankingRecords[index].userName;
|
||||
}
|
||||
|
||||
getScoreAt(index) {
|
||||
return this.rankingRecords[index].score;
|
||||
getBestRecordAt(index) {
|
||||
return this.rankingRecords[index].bestRecord;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -51,20 +51,20 @@ class SessionStorageManager {
|
||||
return sessionStorage.getItem("playingAppName");
|
||||
}
|
||||
|
||||
// score
|
||||
set score(value) {
|
||||
sessionStorage.setItem("score", value);
|
||||
// record
|
||||
set record(value) {
|
||||
sessionStorage.setItem("record", value);
|
||||
}
|
||||
get score() {
|
||||
return sessionStorage.getItem("score");
|
||||
get record() {
|
||||
return sessionStorage.getItem("record");
|
||||
}
|
||||
|
||||
// score
|
||||
set highScore(value) {
|
||||
sessionStorage.setItem("highScore", value);
|
||||
// best record
|
||||
set bestRecord(value) {
|
||||
sessionStorage.setItem("bestRecord", value);
|
||||
}
|
||||
get highScore() {
|
||||
return sessionStorage.getItem("highScore");
|
||||
get bestRecord() {
|
||||
return sessionStorage.getItem("bestRecord");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,12 +5,12 @@ class StringUtil {
|
||||
return (dateTime.getMonth() + 1) + "월 " + dateTime.getDate() + "일";
|
||||
}
|
||||
|
||||
static getScoreTextWithoutUnit(value) {
|
||||
static getRecordTextWithoutUnit(value) {
|
||||
let number = Math.floor(value);
|
||||
return NumberUtil.numberWithCommas(number);
|
||||
}
|
||||
|
||||
static getScoreTextWithUnit(value) {
|
||||
static getRecordTextWithUnit(value) {
|
||||
let number = Math.floor(value);
|
||||
let numberWithCommas = NumberUtil.numberWithCommas(number);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user