More big updates (just incase hdd dies or something)

This commit is contained in:
zkldi
2021-07-29 19:15:24 +01:00
parent 3a80c4ac93
commit bc6d4e4d60
16 changed files with 404 additions and 40 deletions
+32
View File
@@ -0,0 +1,32 @@
import {
ChartDocument,
Game,
IDStrings,
integer,
SessionScoreInfo,
SongDocument,
} from "tachi-common";
export function GetPBs(scoreInfo: SessionScoreInfo[]) {
return scoreInfo.map(e => e.isNewScore === true || e.lampDelta > 0 || e.scoreDelta > 0);
}
export function CreateSongMap<G extends Game = Game>(songs: SongDocument<G>[]) {
const songMap = new Map<integer, SongDocument<G>>();
for (const song of songs) {
songMap.set(song.id, song);
}
return songMap;
}
export function CreateChartMap<I extends IDStrings = IDStrings>(charts: ChartDocument<I>[]) {
const chartMap = new Map<string, ChartDocument<I>>();
for (const chart of charts) {
chartMap.set(chart.chartID, chart);
}
return chartMap;
}