Detect intermission clock and return Intermission state - #8
Conversation
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.
There was a problem hiding this comment.
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).Runningfrom 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.
| # 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" |
There was a problem hiding this comment.
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).
| # 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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| > **`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"`. |
There was a problem hiding this comment.
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.
Checks if the intermission clock is running and overrides game_state to 'Intermission' so the display shows halftime correctly.