From 8225938e8114ed9578e9f887144c734e406b84cc Mon Sep 17 00:00:00 2001 From: Ky Duyen Date: Tue, 4 Jun 2024 23:52:48 -0500 Subject: [PATCH] Fixes issue #221 Made "my assignments" tab only show the one team you're assigned to --- voyager/src/routes/scouting/match/+page.svelte | 4 ++-- voyager/src/routes/scouting/match/+page.ts | 12 +++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/voyager/src/routes/scouting/match/+page.svelte b/voyager/src/routes/scouting/match/+page.svelte index 1e4fde1b..8af311aa 100644 --- a/voyager/src/routes/scouting/match/+page.svelte +++ b/voyager/src/routes/scouting/match/+page.svelte @@ -17,7 +17,7 @@ { id: 'all', icon: 'groups', label: 'All' } ]; - $: initialActiveIndex = data.myMatches.length ? 0 : 1; + $: initialActiveIndex = data.myTeams.length ? 0 : 1; const { snackbar } = getPageLayoutContexts(); addRefreshButtonFunctionality(async () => { @@ -52,7 +52,7 @@

- + diff --git a/voyager/src/routes/scouting/match/+page.ts b/voyager/src/routes/scouting/match/+page.ts index b49fb16a..549e0bf9 100644 --- a/voyager/src/routes/scouting/match/+page.ts +++ b/voyager/src/routes/scouting/match/+page.ts @@ -36,6 +36,10 @@ export const load: PageLoad = async ({ fetch, parent, url }) => { const myMatches = grouped.filter(match => match.some(asg => asg.assigned_scorer?.id === user_id) ).slice(0, maxNumMatches); + + const myTeams = myMatches.map(match => + match.filter(asg => asg.assigned_scorer?.id === user_id) + ); const allMatches = grouped.slice(0, maxNumMatches); @@ -49,5 +53,11 @@ export const load: PageLoad = async ({ fetch, parent, url }) => { } let checksum = syncStatus.data.checksum.substring(0, 3) as string; - return { myMatches, allMatches, firstMatchNumber, checksum }; + console.log('Assignments:', assignments); + console.log('Grouped:', grouped); + console.log('My Matches:', myMatches); + console.log('My Team Matches:', myTeams); + console.log('User ID', user_id); + return { myMatches, myTeams, allMatches, firstMatchNumber, checksum }; + };