Skip to content

Commit

Permalink
fix: same top score in a region
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftpsh committed Dec 25, 2024
1 parent 9c84c39 commit e9da1f2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions app/2025/data/championship.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const combineRegions = (regions: Region[]) => {
});

// D4-3: smallest value for each region (they are removed)
const regionsSet = new Set<string>();
const regionsMap = new Map<string, number>();
teams.forEach((team) => {
if (
team.status === TeamRankInCombinedScoreboardStatus.D4_2_1 ||
Expand All @@ -108,10 +108,14 @@ export const combineRegions = (regions: Region[]) => {
}
const teamRegion = institutionRegionMap.get(team.institution);
if (!teamRegion) return;
if (regionsSet.has(teamRegion)) return;
regionsSet.add(teamRegion);
if (
regionsMap.has(teamRegion) &&
team.assignedValue > regionsMap.get(teamRegion)!
)
return;
regionsMap.set(teamRegion, team.assignedValue);
team.status = TeamRankInCombinedScoreboardStatus.D4_3;
team.sortKey = -500;
team.sortKey = -500 + team.assignedValue;
});

// D2: Two top teams of the South Pacific Independent Regional Contest
Expand Down

0 comments on commit e9da1f2

Please sign in to comment.