Skip to content

Commit

Permalink
support wins/points scoring
Browse files Browse the repository at this point in the history
  • Loading branch information
craigkai committed Jan 19, 2024
1 parent b67f135 commit 758e080
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/lib/components/tournament/Standings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,21 @@
return acc;
}, {});
const scoring = event.scoring;
$matches.matches.forEach((match: MatchRow) => {
if (match.team1_score && match.team2_score) {
teamScores[match.matches_team1_fkey.name] += match.team1_score;
teamScores[match.matches_team2_fkey.name] += match.team2_score;
if (scoring === 'points') {
teamScores[match.matches_team1_fkey.name] += match.team1_score;
teamScores[match.matches_team2_fkey.name] += match.team2_score;
} else {
teamScores[match.matches_team1_fkey.name] += match.team1_score > match.team2_score ? 1 : 0;
teamScores[match.matches_team2_fkey.name] += match.team2_score > match.team1_score ? 1 : 0;
}
}
});
const orderedTeamScores = Object.keys(teamScores).sort((a, b) => teamScores[b] - teamScores[a]);
const scoring = event.scoring;
</script>

Scoring based on {scoring}
Expand Down

1 comment on commit 758e080

@vercel
Copy link

@vercel vercel bot commented on 758e080 Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

volleyman – ./

volleyman-craigkai.vercel.app
volleyman.vercel.app
volleyman-git-main-craigkai.vercel.app

Please sign in to comment.