brackt/app/services/standings-sync
Chris Parsons e353c17a0b
Some checks failed
🚀 Deploy / 🧪 Test (pull_request) Successful in 2m28s
🚀 Deploy / ʦ TypeScript (pull_request) Failing after 1m9s
🚀 Deploy / 🔍 Lint (pull_request) Successful in 46s
🚀 Deploy / 🐳 Build (pull_request) Has been skipped
🚀 Deploy / 🚀 Deploy (pull_request) Has been skipped
Fix MLB standings 406 error and refactor ESPN adapter shared code
- Switch MLB standings from deprecated statsapi.mlb.com to ESPN API
  (same source as NBA, WNBA, MLS — no auth required)
- Extract shared espn.ts utility: EspnStat/Team/Entry/Group/Response
  interfaces, statsMap(), flattenEspnStandings(), parseConferenceRank(),
  sortByWinLoss(); removes 4× duplication across adapters
- Fix parseConferenceRank falsy-zero bug (|| undefined → isNaN guard)
- Add stable alphabetical tiebreaker to MLB, NBA, WNBA sort comparators
- Fix winPct silent-zero: fall back to wins/(wins+losses) if ESPN omits stat
- Pre-build statsMap once per entry before sorting in all adapters
- Fix WNBA parseEntry to accept pre-computed sm instead of rebuilding it
- Restore and update gamesBack tests (ESPN returns numeric 0 for leaders,
  not the old API's "-" string)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 18:18:15 -07:00
..
__tests__ Fix MLB standings 406 error and refactor ESPN adapter shared code 2026-05-31 18:18:15 -07:00
afl.ts Fix oxlint errors. 2026-03-22 20:41:44 -07:00
epl.ts Deduplicate soccer simulator helpers (#391) 2026-05-07 11:48:57 -07:00
espn.ts Fix MLB standings 406 error and refactor ESPN adapter shared code 2026-05-31 18:18:15 -07:00
f1.ts Add regular season standings for NBA/NHL (fixes #89) (#192) 2026-03-21 00:12:01 -07:00
index.ts Add MLS standings sync and fix simulator conference resolution (#423) 2026-05-14 15:39:40 -07:00
mlb.ts Fix MLB standings 406 error and refactor ESPN adapter shared code 2026-05-31 18:18:15 -07:00
mls.ts Fix MLB standings 406 error and refactor ESPN adapter shared code 2026-05-31 18:18:15 -07:00
nba.ts Fix MLB standings 406 error and refactor ESPN adapter shared code 2026-05-31 18:18:15 -07:00
nhl.ts Add regular season standings for NBA/NHL (fixes #89) (#192) 2026-03-21 00:12:01 -07:00
thesportsdb.ts Add regular season standings for NBA/NHL (fixes #89) (#192) 2026-03-21 00:12:01 -07:00
types.ts Deduplicate soccer simulator helpers (#391) 2026-05-07 11:48:57 -07:00
wnba.ts Fix MLB standings 406 error and refactor ESPN adapter shared code 2026-05-31 18:18:15 -07:00