Skip to content

Commit

Permalink
Fixes issue FIRSTTeam102#221
Browse files Browse the repository at this point in the history
Made "my assignments" tab only show the one team you're assigned to
  • Loading branch information
daonguyenk06 committed Jun 5, 2024
1 parent 7642ce3 commit 8225938
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions voyager/src/routes/scouting/match/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -52,7 +52,7 @@
</p>

<SlidingTabs {tabs} {initialActiveIndex}>
<MatchAssignmentList slot="1" matches={data.myMatches} firstMatchNumber={data.firstMatchNumber} />
<MatchAssignmentList slot="1" matches={data.myTeams} firstMatchNumber={data.firstMatchNumber} />
<MatchAssignmentList slot="2" matches={data.allMatches} firstMatchNumber={data.firstMatchNumber} />
</SlidingTabs>
</section>
12 changes: 11 additions & 1 deletion voyager/src/routes/scouting/match/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 };

};

0 comments on commit 8225938

Please sign in to comment.