feat(scoreboards): pick favourite teams from a list instead of typing codes - #290
feat(scoreboards): pick favourite teams from a list instead of typing codes#290ChuckBuilds wants to merge 1 commit into
Conversation
… codes favorite_teams was a free-text array of abbreviations with nothing validating the contents -- just a description saying "use 2-3 letter codes". A wrong or stale code saved cleanly and then matched nothing, and the result is an empty screen with no error anywhere to explain it. The roster is now an enum with display names, rendered as the same checkbox-group the odds ticker already uses for exactly this. Prompted by a user reporting that PHI did not work for the Phillies while NYY worked for the Yankees -- I could not reproduce that (ESPN returns PHI in both the teams endpoint and live game data, and the resolver passes it through unchanged), but a picker removes the whole class of mistake rather than that one instance. MLB, NFL, NBA, WNBA and NHL. The college leagues keep the text field: a checkbox grid of several hundred teams is worse than typing one. scripts/check_team_pickers.py already validates pickers against ESPN and fails when a roster drifts, so these are covered by it from now on. Its league-key discovery took a fixed trail offset, which reported hockey's nested .../nhl/properties/teams/properties/favorite_teams as league "teams" and could not resolve it; it now walks back to the nearest segment that names a league, and all nine pickers validate. Existing configurations are unaffected -- the codes were already ESPN's, so anything valid today stays valid. Verified: PHI, NYY and TB are all accepted, a plausible typo like PHL is not. Harness clean on the four plugins; the two failing tests are the pre-existing missing-src ones on main. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> 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 | 0 |
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.
Why
favorite_teamswas a free-text array with nothing validating it — just a description saying "use 2-3 letter codes":{"type": "array", "items": {"type": "string"}, "default": [], "description": "List of favorite MLB team abbreviations (e.g., NYY, BOS, LAD)."}A wrong or stale code saves cleanly and then matches nothing, and the result is an empty screen with no error anywhere. That's the same failure
scripts/check_team_pickers.pywas written to prevent for the pickers that already exist:What changed
The roster is now an enum with display names, rendered as the same
checkbox-groupwidget the odds ticker already uses for exactly this purpose. MLB, NFL, NBA, WNBA and NHL.College leagues deliberately keep the text field — a checkbox grid of several hundred teams is worse than typing one.
On the report that prompted it
A user found
PHIdidn't work for the Phillies whileNYYworked for the Yankees. I could not reproduce that, and I'd rather say so than imply this fixes it:PHI(id 22,philadelphia-phillies)PHI—MIN (Minnesota Twins) vs PHI (Philadelphia Phillies)PHI.pngexists inassets/sports/mlb_logos/on every machine checkedDynamicTeamResolver.resolve_teamspassesPHIthrough unchanged, identically toNYYA picker removes the whole class of mistake rather than that one instance. If the Phillies still don't appear with
PHIselected from the list, that's a matching bug worth chasing separately, and the picker will have ruled out the config as the cause.Tooling fix included
check_team_pickers.pyderived the league key from a fixed trail offset (trail[-3]). Hockey nests its list one level deeper —.../nhl/properties/teams/properties/favorite_teams— so it reported the league asteamsand failed with "unknown league key". It now walks back to the nearest segment that names a league.All nine pickers validate:
Compatibility
Existing configurations are unaffected — the codes were already ESPN's, so anything valid today stays valid. Verified
PHI,NYYandTBare all accepted by the new enum, and a plausible typo likePHLis not.default: []anduniqueItemspreserved.Safety harness clean on all four plugins; the two failing tests are the pre-existing missing-
srcones that also fail onmain.