Skip to content

Commit

Permalink
add total teams
Browse files Browse the repository at this point in the history
  • Loading branch information
zineanteoh committed Oct 29, 2023
1 parent 58d7e03 commit ebe8f06
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions components/Organizer/JudgingTab/Scoreboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function Scoreboard(props: AllScoresProps) {
let { scoreData, teamData } = data;

// fancy algorithm to compute scoreboard data
const teamScoreboardData = computeScoreboard(scoreData, teamData);
const { teamScoreboardData, teamsJudged } = computeScoreboard(scoreData, teamData);

const handleChange = (pagination: any, filters: any, sorter: any) => {
setSortedInfo(sorter as SorterResult<TeamData>);
Expand Down Expand Up @@ -185,7 +185,9 @@ export default function Scoreboard(props: AllScoresProps) {
width: '100%',
justifyContent: 'space-between',
}}>
<h2>Scoreboard ({teamScoreboardData.length ?? 0})</h2>
<h2>
Scoreboard ({teamsJudged} / {teamScoreboardData.length ?? 0})
</h2>
<Button type="primary" onClick={clearFilters}>
Clear filters
</Button>
Expand Down Expand Up @@ -264,7 +266,7 @@ const computeScoreboard = (scoreData: ScoreData[], teamData: TeamData[]) => {
};
});

teamScoreboardData = teamScoreboardData.filter(team => team.count > 0);
const teamsJudged = teamScoreboardData.filter(team => team.count > 0).length;

teamScoreboardData.sort((a, b) => b.norm_score - a.norm_score);
let diff = 0;
Expand All @@ -284,5 +286,5 @@ const computeScoreboard = (scoreData: ScoreData[], teamData: TeamData[]) => {
team.rank = index + 1 - diff;
});

return teamScoreboardData;
return { teamScoreboardData, teamsJudged };
};

1 comment on commit ebe8f06

@vercel
Copy link

@vercel vercel bot commented on ebe8f06 Oct 29, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.