parent
35f522fd99
commit
781e25848d
|
@ -635,13 +635,13 @@ export class GameData {
|
|||
async saveRunHistory(scene: BattleScene, runEntry : SessionSaveData, isVictory: boolean): Promise<boolean> {
|
||||
const runHistoryData = await this.getRunHistoryData(scene);
|
||||
// runHistoryData should always return run history or {} empty object
|
||||
const timestamps = Object.keys(runHistoryData);
|
||||
const timestampsNo = timestamps.map(Number);
|
||||
let timestamps = Object.keys(runHistoryData).map(Number);
|
||||
|
||||
// Arbitrary limit of 25 entries per user --> Can increase or decrease
|
||||
while (timestamps.length >= RUN_HISTORY_LIMIT ) {
|
||||
const oldestTimestamp = Math.min.apply(Math, timestampsNo);
|
||||
const oldestTimestamp = (Math.min.apply(Math, timestamps)).toString();
|
||||
delete runHistoryData[oldestTimestamp];
|
||||
timestamps = Object.keys(runHistoryData).map(Number);
|
||||
}
|
||||
|
||||
const timestamp = (runEntry.timestamp).toString();
|
||||
|
|
Loading…
Reference in New Issue