fix(soccer): look two weeks ahead for fixtures, matching the real fetch - #285
fix(soccer): look two weeks ahead for fixtures, matching the real fetch#285ChuckBuilds wants to merge 1 commit into
Conversation
Reported by a user: Manchester United never appeared even though their next fixture was 22 August, and with favourites turned off the board showed exactly one Premier League game, Arsenal v Coventry. _get_weeks_data() is the partial that serves the display until the background fetch lands. It looked ahead seven days; _fetch_soccer_api_data(), the fetch it substitutes for, looks ahead fourteen. So a fixture inside the real window was simply missing from the board. That gap is invisible in a league that plays daily and severe in one that plays weekly, where a whole matchweek can fall inside it. Reproduced against ESPN on 2026-08-14: -2w..+1w 20260731-20260821 -> 1 event (COV @ ARS, the 21st) -2w..+4w 20260731-20260911 -> 30 events (MAN @ HUL on the 22nd, ...) The Premier League's opening matchweek was 21-24 August, so a +7d horizon caught the Friday opener and hid the other nine fixtures -- exactly the single game the user described. Both horizons now come from one pair of module constants, so the partial cannot silently end up narrower than the fetch it stands in for again. The test reads the full fetch's span out of soccer_managers.py and requires the partial to be at least as wide, rather than hard-coding either number. Mutation-checked: reverting the horizon, re-hardcoding the window in _get_weeks_data, and narrowing the back-window are all caught. Harness clean; soccer's other tests pass. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01Udr6MfaFLUPhX5Fgo67Jf5
|
Important Review available on request
Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 25 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Fixes the user report: Manchester United never appearing, and only Arsenal v Coventry showing when favourites were turned off.
The bug
Two windows in the same code path disagreed:
_fetch_soccer_api_data_get_weeks_dataThe partial exists to stand in for the full fetch, so a fixture inside the real window was missing from the board until the background fetch landed.
That gap is invisible in a league that plays daily, and severe in one that plays weekly — a whole matchweek can fall inside it. Reproduced against ESPN on 2026-08-14:
The Premier League's opening matchweek was 21–24 August. A +7d horizon on the 14th caught the Friday opener and hid the other nine fixtures — which is exactly the single game the user described seeing, and exactly why their favourite team never appeared.
The fix
Both horizons come from one pair of module constants, so the partial cannot silently end up narrower than the fetch it substitutes for again.
Verification
The test reads the full fetch's span out of
soccer_managers.pyvia the AST and requires the partial to be at least as wide, rather than hard-coding either number — so widening one and forgetting the other fails the test. It also pins the reported case as dates rather than a live API call, keeping it deterministic: a fixture 8 days out must be covered, and must not have been at the old +7d horizon.Mutation-checked: reverting the horizon, re-hardcoding the window in
_get_weeks_data, and narrowing the back-window are all caught.Safety harness clean; soccer's other tests pass.
Not addressed here
The same reporter raised two other issues. Baseball going blank after changing recent-games 5→1 is not explained by this —
recent_games_to_showis scoped to the recent mode and cannot affect upcoming or live, and baseball passes the empty-mode regression test. Their third report (live-mode toggle blanking the board) is plausibly this same thin schedule seen through live priority, but I have not confirmed that chain and am not claiming it.