Skip to content

feat(sports): ask for more ticker turns when a favorite is playing - #274

Open
ChuckBuilds wants to merge 2 commits into
mainfrom
feat/vegas-favorite-weight
Open

feat(sports): ask for more ticker turns when a favorite is playing#274
ChuckBuilds wants to merge 2 commits into
mainfrom
feat/vegas-favorite-weight

Conversation

@ChuckBuilds

@ChuckBuilds ChuckBuilds commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Companion to LEDMatrix#457, which adds the core side. This does nothing without it.

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_teams lives in the plugin. So each scoreboard now answers for itself:

def get_vegas_priority_weight(self):
    if not (self.has_live_priority() and self.has_live_content()):
        return None                        # let the core decide
    vegas = (self.global_config or {}).get('display', {}).get('vegas_scroll', {})
    if self._favorite_team_is_live():
        return vegas.get('favorite_live_weight', 5)
    return vegas.get('live_weight', 3)

Returning None when 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:

  • The weight is per plugin, not per game. A scoreboard with four live games still occupies one slot at a time and picks between its own games with favorite_live_boost; these weights control how often the scoreboard comes round.
  • More slots make the cycle longer, not faster — and appearing more often only helps if the data is fresh, which is the plugin's own live update interval, not this.

Safety

Nothing changes until the core's display.vegas_scroll.live_in_ticker is 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.py in each plugin (10 files, 12 checks each): nothing live yields None, a live game yields live_weight, a favorite on either side yields favorite_live_weight, matching is case-insensitive, any of the plugin's leagues can supply the favorite, sensible defaults when the config is silent, and malformed live_games entries (non-dicts, None abbreviations) 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

    • Live games across ten scoreboard plugins now receive increased Vegas ticker visibility.
    • Games involving configured favorite teams receive additional ticker priority.
    • Added configuration guidance for live ticker display, weighting, rotation, and refresh behavior.
  • Documentation

    • Expanded scoreboard plugin documentation with Vegas ticker setup instructions.
  • Tests

    • Added coverage for live-game weighting, favorite-team matching, defaults, invalid data, and error handling.

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
@codacy-production

codacy-production Bot commented Aug 12, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 396 complexity

Metric Results
Complexity 396

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.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@ChuckBuilds, you've reached your PR review limit, so we couldn't start this review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3620936b-501d-4d38-b8f5-02e1318d1602

📥 Commits

Reviewing files that changed from the base of the PR and between 3a7cd13 and d1b4570.

📒 Files selected for processing (41)
  • plugins.json
  • plugins/afl-scoreboard/README.md
  • plugins/afl-scoreboard/manager.py
  • plugins/afl-scoreboard/manifest.json
  • plugins/afl-scoreboard/test_vegas_priority_weight.py
  • plugins/baseball-scoreboard/README.md
  • plugins/baseball-scoreboard/manager.py
  • plugins/baseball-scoreboard/manifest.json
  • plugins/baseball-scoreboard/test_vegas_priority_weight.py
  • plugins/basketball-scoreboard/README.md
  • plugins/basketball-scoreboard/manager.py
  • plugins/basketball-scoreboard/manifest.json
  • plugins/basketball-scoreboard/test_vegas_priority_weight.py
  • plugins/cricket-scoreboard/README.md
  • plugins/cricket-scoreboard/manager.py
  • plugins/cricket-scoreboard/manifest.json
  • plugins/cricket-scoreboard/test_vegas_priority_weight.py
  • plugins/football-scoreboard/README.md
  • plugins/football-scoreboard/manager.py
  • plugins/football-scoreboard/manifest.json
  • plugins/football-scoreboard/test_vegas_priority_weight.py
  • plugins/hockey-scoreboard/README.md
  • plugins/hockey-scoreboard/manager.py
  • plugins/hockey-scoreboard/manifest.json
  • plugins/hockey-scoreboard/test_vegas_priority_weight.py
  • plugins/lacrosse-scoreboard/README.md
  • plugins/lacrosse-scoreboard/manager.py
  • plugins/lacrosse-scoreboard/manifest.json
  • plugins/lacrosse-scoreboard/test_vegas_priority_weight.py
  • plugins/nrl-scoreboard/README.md
  • plugins/nrl-scoreboard/manager.py
  • plugins/nrl-scoreboard/manifest.json
  • plugins/nrl-scoreboard/test_vegas_priority_weight.py
  • plugins/soccer-scoreboard/README.md
  • plugins/soccer-scoreboard/manager.py
  • plugins/soccer-scoreboard/manifest.json
  • plugins/soccer-scoreboard/test_vegas_priority_weight.py
  • plugins/ufc-scoreboard/README.md
  • plugins/ufc-scoreboard/manager.py
  • plugins/ufc-scoreboard/manifest.json
  • plugins/ufc-scoreboard/test_vegas_priority_weight.py
📝 Walkthrough

Walkthrough

Ten 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.

Changes

Vegas ticker weighting

Layer / File(s) Summary
Plugin weighting hooks
plugins/*/manager.py
Each scoreboard plugin returns configured live or favorite-live weights when qualifying live content exists. Favorite-team detection scans live games across managers with case-insensitive matching and defensive error handling.
Standalone validation
plugins/*/test_vegas_priority_weight.py
Executable harnesses test disabled states, live weights, favorite matching, defaults, malformed data, exceptions, and process exit results.
Configuration and release metadata
plugins/*/README.md, plugins/*/manifest.json, plugins.json
Documentation describes Vegas ticker settings and rotation behavior. Manifests and the plugin registry record the new plugin versions and releases.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 29.17% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: increasing Vegas ticker turns when a favorite team is playing.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/vegas-favorite-weight

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5c90167 and 3a7cd13.

📒 Files selected for processing (41)
  • plugins.json
  • plugins/afl-scoreboard/README.md
  • plugins/afl-scoreboard/manager.py
  • plugins/afl-scoreboard/manifest.json
  • plugins/afl-scoreboard/test_vegas_priority_weight.py
  • plugins/baseball-scoreboard/README.md
  • plugins/baseball-scoreboard/manager.py
  • plugins/baseball-scoreboard/manifest.json
  • plugins/baseball-scoreboard/test_vegas_priority_weight.py
  • plugins/basketball-scoreboard/README.md
  • plugins/basketball-scoreboard/manager.py
  • plugins/basketball-scoreboard/manifest.json
  • plugins/basketball-scoreboard/test_vegas_priority_weight.py
  • plugins/cricket-scoreboard/README.md
  • plugins/cricket-scoreboard/manager.py
  • plugins/cricket-scoreboard/manifest.json
  • plugins/cricket-scoreboard/test_vegas_priority_weight.py
  • plugins/football-scoreboard/README.md
  • plugins/football-scoreboard/manager.py
  • plugins/football-scoreboard/manifest.json
  • plugins/football-scoreboard/test_vegas_priority_weight.py
  • plugins/hockey-scoreboard/README.md
  • plugins/hockey-scoreboard/manager.py
  • plugins/hockey-scoreboard/manifest.json
  • plugins/hockey-scoreboard/test_vegas_priority_weight.py
  • plugins/lacrosse-scoreboard/README.md
  • plugins/lacrosse-scoreboard/manager.py
  • plugins/lacrosse-scoreboard/manifest.json
  • plugins/lacrosse-scoreboard/test_vegas_priority_weight.py
  • plugins/nrl-scoreboard/README.md
  • plugins/nrl-scoreboard/manager.py
  • plugins/nrl-scoreboard/manifest.json
  • plugins/nrl-scoreboard/test_vegas_priority_weight.py
  • plugins/soccer-scoreboard/README.md
  • plugins/soccer-scoreboard/manager.py
  • plugins/soccer-scoreboard/manifest.json
  • plugins/soccer-scoreboard/test_vegas_priority_weight.py
  • plugins/ufc-scoreboard/README.md
  • plugins/ufc-scoreboard/manager.py
  • plugins/ufc-scoreboard/manifest.json
  • plugins/ufc-scoreboard/test_vegas_priority_weight.py

Comment thread plugins/basketball-scoreboard/README.md
Comment thread plugins/cricket-scoreboard/manager.py
Comment thread plugins/football-scoreboard/manager.py
Comment thread plugins/ufc-scoreboard/README.md
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
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