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:
+15
-1
@@ -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[] {
|
||||
|
||||
Reference in New Issue
Block a user