fix: show placeholder badge for defunct nations with no flag-icons code
Soviet Union (su), Yugoslavia (yu), East Germany, Germany DR, FR Yugoslavia, and Czechoslovakia have no valid entry in flag-icons. Map them to null in TEAM_ISO so getIso() returns null, and render a muted initials badge in TeamFlag instead of a broken/empty sprite. Also drop the buggy 2-char substring fallback that generated random valid codes for unknown teams. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -130,9 +130,9 @@ async function run() {
|
||||
|
||||
const teamCache = new Map<string, number>()
|
||||
|
||||
async function upsertTeam(rawName: string, extra?: { iso2?: string; fifaCode?: string; continent?: string; confederation?: string }) {
|
||||
async function upsertTeam(rawName: string, extra?: { iso2?: string | null; fifaCode?: string; continent?: string; confederation?: string }) {
|
||||
if (teamCache.has(rawName)) return teamCache.get(rawName)!
|
||||
const iso2 = extra?.iso2 ?? getIso(rawName)
|
||||
const iso2 = (extra && 'iso2' in extra) ? extra.iso2 : getIso(rawName)
|
||||
const [row] = await db.execute(sql`
|
||||
INSERT INTO teams (name, iso2, fifa_code, continent, confederation)
|
||||
VALUES (${rawName}, ${iso2 ?? null}, ${extra?.fifaCode ?? null}, ${extra?.continent ?? null}, ${extra?.confederation ?? null})
|
||||
|
||||
Reference in New Issue
Block a user