Fix upcoming games disappearing across season boundaries - #238
Open
gerber55555 wants to merge 3 commits into
Open
Fix upcoming games disappearing across season boundaries#238gerber55555 wants to merge 3 commits into
gerber55555 wants to merge 3 commits into
Conversation
Development
Development
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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}/scheduleendpoint returns only the current season type. Right now (early September) it responds withseason.type: 1(Preseason) and exactly three completed preseason games — the September 13 regular-season opener isn't in the response at all — soextractNextGamereturnsnulland the Upcoming section stays empty for the whole gap week.The fix
When the current season type yields no future game,
getTeamSchedulechases the later season types (?seasontype=2, then3) until one turns up.nullis cached as todayVerified against the live API:
CHIpreviously resolved tonull; with the fix it resolves toCHI @ CAR, Sun Sep 13 1:00 pmvia theseasontype=2chase.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