fix(live): scope the live standing to the current heat's run (not a cross-heat total)#313
Merged
Merged
Conversation
…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>
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.
Race control's live standing showed aggregate laps (a pilot's total across every heat flown) instead of the current heat.
Cause:
current_run_startdefaulted 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 cigreen.🤖 Generated with Claude Code