Repository navigation
Order the gamecast timeline by match phase - #44
Merged
Merged
Conversation
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>
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the first half ran into stoppage time, the timeline showed the second-half Kick Off
45'before the Half Time49'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 to45', so it sorted ahead of Half Time at49'.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
TimelineOrderTestcovers the exact49' → 45'boundary, Half Time closing the first half, and within-half minute ordering.KICK OFF → … → HALF TIME → KICK OFFwith no minutes, while team events keep theirs.🤖 Generated with Claude Code