Skip to content

Order the gamecast timeline by match phase - #44

Merged
ylynfatt merged 2 commits into
mainfrom
timeline-phase-ordering
Jun 14, 2026
Merged

ylynfatt merged 2 commits into
mainfrom
timeline-phase-ordering

Conversation

@ylynfatt

Copy link
Copy Markdown
Owner

Problem

When the first half ran into stoppage time, the timeline showed the second-half Kick Off 45' before the Half Time 49' marker — backwards, since the second half kicks off after half time.

Cause

The timeline sorted purely by minute. A flat minute sort can't distinguish a first-half stoppage minute (45+) from a second-half minute (45+): the second-half kick-off's clock snaps back to 45', so it sorted ahead of Half Time at 49'.

Fix

Game::timelineEvents() walks events in the order they were recorded, opening a new period at each Kick Off, then sorts by (period, minute, stoppage, id). Half Time now closes the first half and the second-half Kick Off opens the second; within a half, events still sort plainly by minute. The controller feeds both the initial render and the realtime reload from this method.

Also dropped the minute from the phase markers (Kick Off / Half Time / Full Time) — the label alone reads cleaner — driven off GameEventType::isLifecycleEvent().

Verification

  • New TimelineOrderTest covers the exact 49' → 45' boundary, Half Time closing the first half, and within-half minute ordering.
  • Verified live against a real in-progress game: markers now read KICK OFF → … → HALF TIME → KICK OFF with no minutes, while team events keep theirs.
  • 55 gamecast/broadcast tests pass, Pint clean.

🤖 Generated with Claude Code

ylynfatt and others added 2 commits June 14, 2026 01:17
A flat minute sort can't tell a first-half stoppage minute (45+) apart
from a second-half minute (45+), so the second-half kick-off — whose clock
snaps back to 45' — sorted ahead of the Half Time marker at 49'. The
timeline read "Kick Off 45'" before "Half Time 49'", which is backwards.

Add Game::timelineEvents(): it walks events in recorded order, opening a
new period at each Kick Off, then sorts by (period, minute, stoppage, id).
Half Time now closes the first half and the second-half Kick Off opens the
second, while events still sort plainly by minute within a half.

Also drop the minute from the phase markers (Kick Off, Half Time, Full
Time) — the label alone reads cleaner — driven off GameEventType::
isLifecycleEvent() so it stays a single source of truth.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Two identical "Kick Off" markers were ambiguous. Count kick-offs while
assembling the ordered timeline and label the second one "Second Half",
leaving the opener as "Kick Off".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ylynfatt

Copy link
Copy Markdown
Owner Author

Added: the second-half restart now reads "Second Half" (the opener stays "Kick Off"), so the two kick-off markers are no longer ambiguous. Driven by a kick-off count over the ordered timeline; covered by a new assertion in GamecastPageTest. Verified live.

@ylynfatt
ylynfatt merged commit a816116 into main Jun 14, 2026
1 check passed
@ylynfatt
ylynfatt deleted the timeline-phase-ordering branch June 14, 2026 05:24
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.

1 participant