Fix MLB standings 406 error and refactor ESPN adapter shared code #62
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/mlb-standings-espn-refactor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
statsapi.mlb.comreturns 406 (deprecated). Switched MLB to ESPN's free standings API (site.api.espn.com/apis/v2/sports/baseball/mlb/standings), consistent with NBA, WNBA, and MLS.espn.tsutility module, eliminating 4× duplication ofstatsMap(),flattenEspnStandings(), ESPN interfaces, and theplayoffSeed→ conference rank logic across adapters.parseConferenceRank:|| undefinedfalsy-zero bug replaced withisNaNguardwinPct: falls back towins/(wins+losses)if ESPN omits the stat (was silently 0)parseEntry: accepts pre-computedsminstead of rebuilding it internallygamesBack: tests updated to reflect ESPN returns numeric0for division leaders (old API used"-"→undefined)Test plan
npm run test:run -- app/services/standings-sync)🤖 Generated with Claude Code