From 0bdbe2b681575083691cc79446d28b156a1434a2 Mon Sep 17 00:00:00 2001 From: Neshura Date: Tue, 12 Sep 2023 19:28:17 +0200 Subject: [PATCH] Default Graphs Selections Fix --- src/routes/graphs/+layout.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes/graphs/+layout.ts b/src/routes/graphs/+layout.ts index 769cec6..9bb8bcf 100644 --- a/src/routes/graphs/+layout.ts +++ b/src/routes/graphs/+layout.ts @@ -33,7 +33,7 @@ export const load: LayoutLoad = async ({ fetch }) => { } if (typeof gameSelection === 'undefined') { - gameSelection = chellarisData.games[1].id; + gameSelection = Object.values(chellarisData.games)[0].id; } // Game Groups Selection @@ -44,7 +44,7 @@ export const load: LayoutLoad = async ({ fetch }) => { if (typeof gameGroupSelections[gameSelection] === 'undefined') { // Default to all available groups - gameGroupSelections[gameSelection] = { gameId: gameSelection, selectedGroups: Object.fromEntries(Object.values(chellarisData.games[gameSelection].groups).map((group) => group.id).entries()) }; + gameGroupSelections[gameSelection] = { gameId: gameSelection, selectedGroups: Object.fromEntries(Object.values(Object.values(chellarisData.games)[gameSelection].groups).map((group) => group.id).entries()) }; // Set Local Storage to default Values if not previously defined localStorage.setItem('gameGroupSelection', JSON.stringify(gameGroupSelections)); @@ -66,14 +66,14 @@ export const load: LayoutLoad = async ({ fetch }) => { } if (typeof gameSelection === 'undefined') { - gameSelection = chellarisData.games[1].id; + gameSelection = Object.values(chellarisData.games)[0].id; } SelectedGameStore.set(gameSelection); if (typeof gameGroupSelections[gameSelection] === 'undefined') { // Default to all available groups - gameGroupSelections[gameSelection] = { gameId: gameSelection, selectedGroups: Object.fromEntries(Object.values(chellarisData.games[gameSelection].groups).map((group) => group.id).entries()) }; + gameGroupSelections[gameSelection] = { gameId: gameSelection, selectedGroups: Object.fromEntries(Object.values(Object.values(chellarisData.games)[gameSelection].groups).map((group) => group.id).entries()) }; } SelectedGameGroupsStore.set(gameGroupSelections);