fix(soccer-scoreboard): a per-league mode shows only its own league (2.39.4) - #618
Merged
Merged
Conversation
…2.39.4) display() parsed the league out of soccer_<league>_<type> in switch mode and then tried every enabled league's manager for that type, drawing the first with games -- so soccer_esp.1_recent showed the eng.1 card. Only the named league is consulted now; when it has nothing the mode returns False so the core's empty-mode handling moves on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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 | 24 |
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.
# Conflicts: # plugins.json # plugins/soccer-scoreboard/CHANGELOG.md # plugins/soccer-scoreboard/manifest.json
# Conflicts: # plugins.json
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.
Bug
Soccer registers one set of modes per league (
soccer_eng.1_recent,soccer_esp.1_recent, ...). In switch mode,SoccerScoreboardPlugin.display()parsed the league out ofsoccer_<league>_<type>and then ignored it: it looped over every league from_get_enabled_leagues_for_mode(mode_type)and drew the first manager with games. Sosoccer_esp.1_recentshowed the eng.1 card (seen locally and on the ledpi rig), and every league's slot could repeat the same game.Fix
The per-league branch now consults only the league named in the mode. It still has to be in
_get_enabled_leagues_for_mode(mode_type), so a league or mode that is switched off shows nothing. When that league has nothing to show,display()returnsFalseand core's empty-mode handling moves on. The legacysoccer_live/soccer_recent/soccer_upcomingbranch is unchanged. Core no longer registers those names, and pooling every league is what they are meant to do.Version 2.39.4, with a
versions[]entry, a CHANGELOG entry, a one-line README note and the regeneratedplugins.json.Other plugins checked
<sport>_live/_recent/_upcomingwith no league in the name, so they don't have this bug.lax_<league>_<type>): already scoped. It resolves the league against its registry and calls_display_league_mode(league, ...).<league>_<type>): already scoped. They parse the league and call_display_league_mode(league, ...). Their cross-league loop runs only for the legacy combined<sport>_<type>names, the same as soccer'ssoccer_<type>branch.Only soccer is changed.
Not changed (pre-existing, outside this branch)
_display_scroll_modestill builds one strip from every scroll-mode league._should_use_scroll_mode(mode_type)is also true if any enabled league scrolls that type._livemode, whichever league it belongs to.These look like deliberate cross-league behaviour, so they are left alone here.
Tests
plugins/soccer-scoreboard/test_per_league_mode_scope.py. It covers: an empty esp.1 slot returns False and never draws eng.1 (for live, recent and upcoming); each league's slot draws its own league, not the higher-priority one; a custom league code containing underscores; and a disabled league's mode. All four tests fail on main and pass with the fix.test/test_empty_mode_no_blank.py::test_empty_manager_is_skippedasserted the old pooling:soccer_usa.1_recentdrew fifa.world's game. It now asserts the usa.1 slot returns False without drawing either league, and that fifa.world draws in its own slot. The empty-manager gate it guards is still checked.run_plugin_tests.py soccer-scoreboard --core <fresh LEDMatrix main>: 40 passed, 0 failed.scripts/test_*.pywithLEDMATRIX_COREset to a fresh LEDMatrix main clone: 47 of 47 passed (Python 3.14, Pillow 12.3).check_version_bump.py --base origin/main soccer-scoreboard,check_manifest_version_fields.py soccer-scoreboard,check_sports_helpers_parity,check_module_collisions,check_sports_drift,check_min_core_version,check_sports_display_contract,check_scroll_adoption,check_manifests_ascii, andupdate_registry.py --check.Merge order with #615
#615 (soccer 2.39.3, fetch-burst fix) also edits soccer's
manifest.json,CHANGELOG.mdandplugins.json. This PR uses 2.39.4 so both can land. Merge #615 first, then rebase this PR onto main. Keep #615's 2.39.3versions[]and CHANGELOG entries below this PR's 2.39.4 entries, and rerunupdate_registry.py. If this PR merges first instead, #615 has to be renumbered above 2.39.4.🤖 Generated with Claude Code