Skip to content

Detect intermission clock and return Intermission state - #8

Merged
a1ly404 merged 3 commits into
mainfrom
fix/intermission-state-detection
Apr 3, 2026
Merged

Detect intermission clock and return Intermission state#8
a1ly404 merged 3 commits into
mainfrom
fix/intermission-state-detection

Conversation

@a1ly404

@a1ly404 a1ly404 commented Apr 3, 2026

Copy link
Copy Markdown
Owner

Checks if the intermission clock is running and overrides game_state to 'Intermission' so the display shows halftime correctly.

When the intermission clock is running, override the game_state
field to return "Intermission" instead of showing the raw CRG state.
This ensures the display correctly shows halftime status.
Copilot AI review requested due to automatic review settings April 3, 2026 20:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the scoreboard WS client mapping to detect when the scoreboard’s intermission clock is running and force the returned /live game_state to "Intermission" so downstream displays can render halftime/intermission correctly.

Changes:

  • Read ScoreBoard.CurrentGame.Clock(Intermission).Running from the WS state.
  • Override game_fields["game_state"] to "Intermission" when the intermission clock is running.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread client.py
Comment on lines +255 to +258
# Check if intermission clock is running — if so, override game_state to show intermission
intermission_clock_running = self._get("Clock(Intermission).Running", bool)
if intermission_clock_running:
game_fields["game_state"] = "Intermission"

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

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

This introduces new behavior (overriding game_state to "Intermission" when Clock(Intermission).Running is true) but there’s no regression test covering it. Please add a test in tests/test_client.py that pushes ScoreBoard.CurrentGame.Clock(Intermission).Running: True (with a non-intermission State) and asserts client.get_live_state().game_state == "Intermission" (and ideally that it reverts when the flag goes false).

Copilot uses AI. Check for mistakes.
Comment thread client.py
Comment on lines +255 to +258
# Check if intermission clock is running — if so, override game_state to show intermission
intermission_clock_running = self._get("Clock(Intermission).Running", bool)
if intermission_clock_running:
game_fields["game_state"] = "Intermission"

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

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

game_state is mapped from the scoreboard’s State field via GAME_FIELD_MAP, but this change can synthesize a new value ("Intermission") based on the intermission clock. To avoid surprising API consumers, please document this behavior (e.g., in the LiveState.game_state field description / README) so it’s clear game_state may not always reflect the raw scoreboard State.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings April 3, 2026 21:11
@a1ly404
a1ly404 merged commit 9f41136 into main Apr 3, 2026
3 checks passed
@a1ly404
a1ly404 deleted the fix/intermission-state-detection branch April 3, 2026 21:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment on lines +244 to +246
> **`game_state`:** Usually mirrors CRG's raw `State` field, but may be normalized for display use.
> For example, if `Clock(Intermission).Running` is `true`, `/live` returns `"Intermission"`
> even if the raw scoreboard `State` still says `"Running"`.

Copilot AI Apr 3, 2026

Copy link

Choose a reason for hiding this comment

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

The inline-code examples include escaped quotes (e.g. \"Intermission\", \"Running\"), which will render the backslashes in Markdown. Since these are code spans, the quotes don’t need escaping—use "Intermission"/"Running" without the backslashes (or just "Intermission" as plain text) so the README renders cleanly.

Copilot uses AI. Check for mistakes.
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