maybe now?!?
All checks were successful
Deploy / deploy (push) Successful in 2m47s

This commit is contained in:
Lee
2024-09-28 06:31:25 +01:00
parent 32e8468126
commit 0410f6b324
4 changed files with 25 additions and 6 deletions

View File

@ -1,6 +1,6 @@
import mongoose, { Document, Schema } from "mongoose";
import { PlayerHistory } from "@/common/player/player-history";
import { getMidnightAlignedDate } from "@/common/time-utils";
import { formatDate, getMidnightAlignedDate } from "@/common/time-utils";
import ScoreSaberPlayer from "@/common/model/player/impl/scoresaber-player";
// Interface for Player Document
@ -70,7 +70,7 @@ PlayerSchema.methods.getLastTracked = function (): Date {
PlayerSchema.methods.getHistory = function (date: Date): PlayerHistory {
return (
this.statisticHistory.get(getMidnightAlignedDate(date).toUTCString()) || {}
this.statisticHistory.get(formatDate(getMidnightAlignedDate(date))) || {}
);
};
@ -91,8 +91,10 @@ PlayerSchema.methods.setStatisticHistory = function (
if (!this.statisticHistory) {
this.statisticHistory = new Map();
}
const alignedDate = getMidnightAlignedDate(date).toUTCString();
return this.statisticHistory.set(alignedDate, data);
return this.statisticHistory.set(
formatDate(getMidnightAlignedDate(date)),
data,
);
};
PlayerSchema.methods.sortStatisticHistory = function (): Map<