Skip to content

Fix upcoming games disappearing across season boundaries - #238

Open
gerber55555 wants to merge 3 commits into
dathbe:developmentfrom
gerber55555:fix/upcoming-season-rollover
Open

Fix upcoming games disappearing across season boundaries#238
gerber55555 wants to merge 3 commits into
dathbe:developmentfrom
gerber55555:fix/upcoming-season-rollover

Conversation

@gerber55555

Copy link
Copy Markdown

The bug

With showUpcomingGames: true, an NFL team's upcoming game vanishes during the gap between the preseason and the regular season (and again between the regular season and the playoffs).

ESPN's /teams/{abbr}/schedule endpoint returns only the current season type. Right now (early September) it responds with season.type: 1 (Preseason) and exactly three completed preseason games — the September 13 regular-season opener isn't in the response at all — so extractNextGame returns null and the Upcoming section stays empty for the whole gap week.

The fix

When the current season type yields no future game, getTeamSchedule chases the later season types (?seasontype=2, then 3) until one turns up.

  • In-season behavior unchanged: no extra requests when the default response already has a future game (the common case — MLB mid-season etc.)
  • Result cached exactly as before (6h TTL)
  • If no season type has a future game, null is cached as today

Verified against the live API: CHI previously resolved to null; with the fix it resolves to CHI @ CAR, Sun Sep 13 1:00 pm via the seasontype=2 chase.

Testing

5 new unit tests (chase to regular season, chase to postseason, no chase when a future game exists, all-types-exhausted caches null, missing season info) — 118/118 passing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01S1UJvj9naLkkQgAGqNLVrw

dathbe and others added 3 commits June 15, 2026 17:02
ESPN's /teams/{abbr}/schedule endpoint returns only the CURRENT season
type. Between the last preseason game and the regular-season opener
(and again between the regular season and the playoffs) every event in
the response is already completed, so extractNextGame finds nothing
and the Upcoming section shows no game — even though the next one is
scheduled days away. Right now (early September) an NFL team's
schedule returns three completed preseason games and nothing else.

When the current season type yields no future game, getTeamSchedule
now chases the later season types (?seasontype=2, then 3) until one
turns up. In-season behavior is unchanged (no extra requests when the
default response already contains a future game), and the result is
cached exactly as before.

Verified against the live API: an NFL team's upcoming game (Sep 13
regular-season opener) that previously resolved to null is now found
via the seasontype=2 chase.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1UJvj9naLkkQgAGqNLVrw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants