mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-06 22:07:58 +03:00
Fix bug where session dropdowns would do nothing.
This commit is contained in:
@@ -8,7 +8,7 @@ import { APIFetchV1 } from "util/api";
|
||||
import { SpecificSessionReturns } from "types/api-returns";
|
||||
import Loading from "components/util/Loading";
|
||||
import DebugContent from "components/util/DebugContent";
|
||||
import { CreateChartMap, CreateChartIDMap, CreateSongMap } from "util/data";
|
||||
import { CreateChartMap, CreateChartIDMap, CreateSongMap, CreateScoreIDMap } from "util/data";
|
||||
import {
|
||||
Lamps,
|
||||
Grades,
|
||||
@@ -236,7 +236,7 @@ function SessionScoreStatBreakdown({
|
||||
}) {
|
||||
const songMap = CreateSongMap(sessionData.songs);
|
||||
const chartMap = CreateChartMap(sessionData.charts);
|
||||
const scoreMap = CreateChartIDMap(sessionData.scores);
|
||||
const scoreMap = CreateScoreIDMap(sessionData.scores);
|
||||
|
||||
const [newLamps, newGrades] = useMemo(() => {
|
||||
const newLamps: Partial<Record<
|
||||
@@ -280,6 +280,7 @@ function SessionScoreStatBreakdown({
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [newLamps, newGrades];
|
||||
}, [chartIDs, filter]);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
SongDocument,
|
||||
ScoreDocument,
|
||||
PublicUserDocument,
|
||||
PBScoreDocument,
|
||||
} from "tachi-common";
|
||||
|
||||
export function GetPBs(scoreInfo: SessionScoreInfo[]) {
|
||||
@@ -53,6 +54,16 @@ export function CreateChartMap<I extends IDStrings = IDStrings>(charts: ChartDoc
|
||||
return chartMap;
|
||||
}
|
||||
|
||||
export function CreateScoreIDMap<I extends IDStrings = IDStrings>(scores: ScoreDocument<I>[]) {
|
||||
const scoreMap = new Map<string, ScoreDocument<I>>();
|
||||
|
||||
for (const score of scores) {
|
||||
scoreMap.set(score.scoreID, score);
|
||||
}
|
||||
|
||||
return scoreMap;
|
||||
}
|
||||
|
||||
export function CreateChartLink(chart: ChartDocument, game: Game) {
|
||||
if (chart.isPrimary) {
|
||||
return `/dashboard/games/${game}/${chart.playtype}/songs/${
|
||||
|
||||
Reference in New Issue
Block a user