fix: normalize Bosnia & Herzegovina and USA team name variants

Add TEAM_ALIASES to lib/wiki-scraper.ts applied at extraction time so both
scraper and sync consistently produce canonical names. Removes the duplicate
alias map from seed.ts in favour of the shared normalizeTeam() export.

Aliases added:
  Bosnia & Herzegovina  → Bosnia and Herzegovina
  USA                   → United States

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-15 17:33:05 +02:00
parent f885e4312c
commit b832b62f5e
2 changed files with 19 additions and 14 deletions
+15 -1
View File
@@ -75,6 +75,20 @@ export async function fetchWikiHtml(page: string, retries = 5): Promise<string |
return null
}
// ── Team name normalisation ────────────────────────────────────────────────
const TEAM_ALIASES: Record<string, string> = {
'West Germany': 'Germany',
'Korea Republic': 'South Korea',
'IR Iran': 'Iran',
'Bosnia & Herzegovina': 'Bosnia and Herzegovina',
'USA': 'United States',
}
export function normalizeTeam(name: string): string {
return TEAM_ALIASES[name] ?? name
}
// ── Parsing helpers ────────────────────────────────────────────────────────
function parseScoreText(text: string): [number, number] | null {
@@ -92,7 +106,7 @@ function extractTeam($: CheerioAPI, $cell: Cheerio<Element>): string {
return false
}
})
return name
return normalizeTeam(name)
}
function parseGoals($: CheerioAPI, $td: Cheerio<Element>): Goal[] {