feat(sports): ask for more ticker turns when a favorite is playing - #274
feat(sports): ask for more ticker turns when a favorite is playing#274ChuckBuilds wants to merge 2 commits into
Conversation
The core already gives any plugin with live content extra slots in the Vegas ticker. What it cannot work out is *whose* game is on: it can see that a scoreboard has something live, but favorite_teams lives here. So each scoreboard now answers for itself via get_vegas_priority_weight() -- favorite_live_weight when one of the configured teams is playing, live_weight when something else is, and None when nothing is live, which leaves the decision to the core rather than asserting a 1. The favorite check walks the plugin's own league managers looking for the pair (live_games, favorite_teams) rather than taking a league argument. Every sport registers one manager per league under its own attribute name, and all of them carry that pair, which is what lets the same implementation serve ten plugins unchanged. None of this does anything until the core's display.vegas_scroll.live_in_ticker is set; with the default the ticker still yields the whole display to a live game. Documented in each plugin's README: what the weights do, that they are per plugin rather than per game (a scoreboard with four live games still takes one slot and picks between them with favorite_live_boost), and that more slots lengthen the cycle rather than speeding it up. Each test fails 9 of its checks against the previous commit. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Udr6MfaFLUPhX5Fgo67Jf5
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 396 |
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.
|
Warning Review limit reached
Next review available in: 35 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (41)
📝 WalkthroughWalkthroughTen scoreboard plugins now provide Vegas ticker priority weights for live games and favorite-team matches. The pull request adds favorite-team detection, standalone validation harnesses, configuration documentation, release metadata, and registry version updates. ChangesVegas ticker weighting
Estimated code review effort: 3 (Moderate) | ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@plugins/basketball-scoreboard/README.md`:
- Around line 460-468: The repeated Vegas ticker JSON snippets are invalid
because they contain only a property fragment; wrap the outer "display" object
in braces, or relabel each block as a fragment. Apply the same correction at
plugins/basketball-scoreboard/README.md lines 460-468,
plugins/cricket-scoreboard/README.md lines 117-125,
plugins/football-scoreboard/README.md lines 588-596,
plugins/hockey-scoreboard/README.md lines 750-758, and
plugins/lacrosse-scoreboard/README.md lines 325-333.
In `@plugins/cricket-scoreboard/manager.py`:
- Around line 417-437: Replace the copied generic _favorite_team_is_live logic
with each plugin’s live-data contract: in
plugins/cricket-scoreboard/manager.py:417-437, inspect self.live_matches and
reuse _match_is_favorite() for nested teams; in
plugins/nrl-scoreboard/manager.py:761-781, inspect self._get_manager("live") and
reuse _team_in() with home_id and away_id; in
plugins/ufc-scoreboard/manager.py:715-735, match normalized fighter1_name and
fighter2_name against favorite_fighters. Use
plugins/nrl-scoreboard/test_vegas_priority_weight.py:43-58 and
plugins/ufc-scoreboard/test_vegas_priority_weight.py:43-58 as the respective
data-shape and matching references; these test sites require no direct change.
In `@plugins/football-scoreboard/manager.py`:
- Around line 1813-1855: Update _favorite_team_is_live in
plugins/football-scoreboard/manager.py (lines 1813-1855) and
plugins/afl-scoreboard/manager.py (lines 739-781) to also inspect
active_celebration["game"] and match its home/away team abbreviations against
favorite_teams, in addition to live_games. Preserve the existing behavior for
live games and return True when either source contains a favorite-team game.
In `@plugins/ufc-scoreboard/README.md`:
- Around line 108-119: Update the UFC release documentation to use fighter
terminology: in plugins/ufc-scoreboard/README.md lines 108-119, replace
favorite_teams, team, and game references with ufc.favorite_fighters, fighter,
and fight terminology; in plugins/ufc-scoreboard/manifest.json lines 35-40,
change “favorite team is playing” to “favorite fighter is in a live fight.”
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 620c49ed-8f38-4b2a-bf29-1f2779dda16f
📒 Files selected for processing (41)
plugins.jsonplugins/afl-scoreboard/README.mdplugins/afl-scoreboard/manager.pyplugins/afl-scoreboard/manifest.jsonplugins/afl-scoreboard/test_vegas_priority_weight.pyplugins/baseball-scoreboard/README.mdplugins/baseball-scoreboard/manager.pyplugins/baseball-scoreboard/manifest.jsonplugins/baseball-scoreboard/test_vegas_priority_weight.pyplugins/basketball-scoreboard/README.mdplugins/basketball-scoreboard/manager.pyplugins/basketball-scoreboard/manifest.jsonplugins/basketball-scoreboard/test_vegas_priority_weight.pyplugins/cricket-scoreboard/README.mdplugins/cricket-scoreboard/manager.pyplugins/cricket-scoreboard/manifest.jsonplugins/cricket-scoreboard/test_vegas_priority_weight.pyplugins/football-scoreboard/README.mdplugins/football-scoreboard/manager.pyplugins/football-scoreboard/manifest.jsonplugins/football-scoreboard/test_vegas_priority_weight.pyplugins/hockey-scoreboard/README.mdplugins/hockey-scoreboard/manager.pyplugins/hockey-scoreboard/manifest.jsonplugins/hockey-scoreboard/test_vegas_priority_weight.pyplugins/lacrosse-scoreboard/README.mdplugins/lacrosse-scoreboard/manager.pyplugins/lacrosse-scoreboard/manifest.jsonplugins/lacrosse-scoreboard/test_vegas_priority_weight.pyplugins/nrl-scoreboard/README.mdplugins/nrl-scoreboard/manager.pyplugins/nrl-scoreboard/manifest.jsonplugins/nrl-scoreboard/test_vegas_priority_weight.pyplugins/soccer-scoreboard/README.mdplugins/soccer-scoreboard/manager.pyplugins/soccer-scoreboard/manifest.jsonplugins/soccer-scoreboard/test_vegas_priority_weight.pyplugins/ufc-scoreboard/README.mdplugins/ufc-scoreboard/manager.pyplugins/ufc-scoreboard/manifest.jsonplugins/ufc-scoreboard/test_vegas_priority_weight.py
The first cut looked for an attribute holding `live_games` beside
`favorite_teams`. That is true of five scoreboards and quietly false for
four:
cricket keeps live_matches, not live_games
nrl,afl hold their managers in a self._managers dict, so walking
attribute values finds the dict and stops
ufc has favorite_fighters, and fighter1_name/fighter2_name
Those four reported every live game as non-favorite -- no crash, no log,
the favorite weight simply never applied. The tests did not catch it
because they used the one shape I had assumed for all ten plugins, so
they were testing the assumption rather than the plugins. Each test now
builds fixtures from its own plugin's contract, and against the previous
commit they fail: cricket 4 checks, nrl 5, afl 5, ufc 4.
The matcher now enumerates the real shapes -- managers held directly or
inside a dict, live_games or live_matches, favorite_teams or
favorite_fighters, identifiers by abbreviation, id or fighter name, and
cricket's nested `teams` matched by substring as that plugin does it
itself.
It also searches active_celebration["game"]. The live manager snapshots
a game there for a reason its own comment gives: the game leaves
live_games while the celebration is still on screen, which is exactly
when a favorite scoring should be earning extra turns.
Also wraps the README config examples in braces so they are valid JSON
rather than property fragments, and puts the UFC docs in fighter terms
rather than teams and games.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Udr6MfaFLUPhX5Fgo67Jf5
What
The core can already give a plugin extra slots in the Vegas ticker when it reports live content. What it cannot work out is whose game is on —
favorite_teamslives in the plugin. So each scoreboard now answers for itself:Returning
Nonewhen nothing is live is deliberate — it defers to the core rather than asserting a weight of 1, so the core stays free to boost this plugin for its own reasons later.One implementation, ten plugins
_favorite_team_is_live()walks the plugin's own attributes looking for the pair(live_games, favorite_teams)rather than taking a league argument. Every sport registers one manager per league under its own attribute name, and all of them carry that pair — verified across baseball, football, hockey, basketball and soccer before writing it. That's what lets the same code serve all ten unchanged.Applied to: afl, baseball, basketball, cricket, football, hockey, lacrosse, nrl, soccer, ufc.
Documented
Each plugin's README gains a "Vegas ticker: seeing live games more often" section covering the config, what the two weights do, and two things that are easy to get wrong:
favorite_live_boost; these weights control how often the scoreboard comes round.Safety
Nothing changes until the core's
display.vegas_scroll.live_in_tickeris set. With the default, live games still take over the whole display exactly as today.Exceptions are swallowed and return
None; the core independently treats a raising hook as weight 1, so a bad answer can never break the rotation.Tests
test_vegas_priority_weight.pyin each plugin (10 files, 12 checks each): nothing live yieldsNone, a live game yieldslive_weight, a favorite on either side yieldsfavorite_live_weight, matching is case-insensitive, any of the plugin's leagues can supply the favorite, sensible defaults when the config is silent, and malformedlive_gamesentries (non-dicts,Noneabbreviations) don't produce false matches or exceptions.Verified non-vacuous: each fails 9 of its 12 checks against the previous commit.
Safety harness passes all 8 sizes on all ten plugins; collisions clean across 43.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Udr6MfaFLUPhX5Fgo67Jf5
Summary by CodeRabbit
New Features
Documentation
Tests