Skip to content

feat(scoreboards): pick favourite teams from a list instead of typing codes - #290

Open
ChuckBuilds wants to merge 1 commit into
mainfrom
feat/scoreboard-team-pickers
Open

feat(scoreboards): pick favourite teams from a list instead of typing codes#290
ChuckBuilds wants to merge 1 commit into
mainfrom
feat/scoreboard-team-pickers

Conversation

@ChuckBuilds

Copy link
Copy Markdown
Owner

Why

favorite_teams was 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.py was written to prevent for the pickers that already exist:

the picker simply does not offer a team that exists, or offers a code that no longer matches anything, and the user gets an empty screen with no error

What changed

The roster is now an enum with display names, rendered as the same checkbox-group widget 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 PHI didn't work for the Phillies while NYY worked for the Yankees. I could not reproduce that, and I'd rather say so than imply this fixes it:

  • ESPN's teams endpoint returns PHI (id 22, philadelphia-phillies)
  • Live game data also returns PHIMIN (Minnesota Twins) vs PHI (Philadelphia Phillies)
  • PHI.png exists in assets/sports/mlb_logos/ on every machine checked
  • DynamicTeamResolver.resolve_teams passes PHI through unchanged, identically to NYY

A picker removes the whole class of mistake rather than that one instance. If the Phillies still don't appear with PHI selected 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.py derived 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 as teams and failed with "unknown league key". It now walks back to the nearest segment that names a league.

All nine pickers validate:

OK  baseball-scoreboard: mlb (30)      OK  hockey-scoreboard: nhl (32)
OK  basketball-scoreboard: nba (30)    OK  odds-ticker: nfl/nba/mlb/nhl
OK  basketball-scoreboard: wnba (15)
OK  football-scoreboard: nfl (32)
OK: 9 picker(s) match ESPN.

Compatibility

Existing configurations are unaffected — the codes were already ESPN's, so anything valid today stays valid. Verified PHI, NYY and TB are all accepted by the new enum, and a plausible typo like PHL is not. default: [] and uniqueItems preserved.

Safety harness clean on all four plugins; the two failing tests are the pre-existing missing-src ones that also fail on main.

… 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
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Important

Review available on request

  • 🔍 Trigger review

Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment @coderabbitai review to review the latest changes. For a full review, comment @coderabbitai full review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: eec6d409-cdae-47bb-9ea5-49de752a0529


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

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.

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