Skip to content

fix(live): scope the live standing to the current heat's run (not a cross-heat total)#313

Merged
ryan-johnson2 merged 1 commit into
develfrom
live-standings-current-heat
Jun 28, 2026
Merged

fix(live): scope the live standing to the current heat's run (not a cross-heat total)#313
ryan-johnson2 merged 1 commit into
develfrom
live-standings-current-heat

Conversation

@ryan-johnson2

Copy link
Copy Markdown
Contributor

Race control's live standing showed aggregate laps (a pilot's total across every heat flown) instead of the current heat.

Cause: current_run_start defaulted to 0 for a never-reset heat, so the live lap fold counted passes from the start of the whole log. Fix: anchor on the heat's latest Running (its current run) — excludes prior heats and abandoned earlier runs; an unraced heat windows past-end (shows zeros). Reset handling + finalized results unchanged.

New cross-heat regression test (q-1 two laps then q-2 one lap → q-2 live count = 1, not 3); cargo xtask ci green.

🤖 Generated with Claude Code

…ross-heat total

Race control's live standing showed AGGREGATE laps — a pilot's total across every heat they'd flown
(bracket levels, round-robin, multi-round qualifying) — instead of just the current heat.

Cause: the live lap fold windows from `current_run_start`, which only advanced past *reset* boundaries
and defaulted to 0 for a never-reset heat. So a normally-running heat folded passes from the start of
the whole log, summing in every earlier heat's passes for that pilot.

Fix: `current_run_start` now anchors on the heat's latest `Running` transition (where its current run
begins — passes only arrive while Running), which sits after every earlier heat and after any abandoned
earlier run of this heat. A heat that hasn't run yet (still Scheduled) windows past the end, so
selecting an unraced heat shows zeros rather than its pilots' prior totals. Reset handling is unchanged
(re-runs still count from zero). Finalized results are unaffected (they're a separate projection).

Tests: new cross-heat case (A flies q-1 two laps then q-2 one lap → q-2's live count is 1, not 3);
updated the never-reset + finalize cases to the Running-anchored boundary. cargo xtask ci green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ryan-johnson2 ryan-johnson2 merged commit 92da43f into devel Jun 28, 2026
3 checks passed
@ryan-johnson2 ryan-johnson2 deleted the live-standings-current-heat branch June 28, 2026 18:47
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