From e9da1f283949bdf9266b7b78ee3613244a405355 Mon Sep 17 00:00:00 2001 From: Suhyun Park Date: Wed, 25 Dec 2024 11:57:49 +0900 Subject: [PATCH] fix: same top score in a region --- app/2025/data/championship.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/2025/data/championship.ts b/app/2025/data/championship.ts index c9e9bb2..9a0d03f 100644 --- a/app/2025/data/championship.ts +++ b/app/2025/data/championship.ts @@ -94,7 +94,7 @@ export const combineRegions = (regions: Region[]) => { }); // D4-3: smallest value for each region (they are removed) - const regionsSet = new Set(); + const regionsMap = new Map(); teams.forEach((team) => { if ( team.status === TeamRankInCombinedScoreboardStatus.D4_2_1 || @@ -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