Skip to content

fix(results): score heat-result projection with the round's win condition (not hardcoded best-lap)#318

Merged
ryan-johnson2 merged 1 commit into
develfrom
fix-heat-result-win-condition
Jun 29, 2026
Merged

fix(results): score heat-result projection with the round's win condition (not hardcoded best-lap)#318
ryan-johnson2 merged 1 commit into
develfrom
fix-heat-result-win-condition

Conversation

@ryan-johnson2

Copy link
Copy Markdown
Contributor

?projection=result was hardcoded to WinCondition::BestLap (#45 placeholder), so served heat results were best-lap-ordered regardless of the round — wrong finishing order in Race control, the round-robin grid, and round-robin points, and disagreeing with the round ranking. Now resolves the heat's round (via its HeatScheduled tag + event meta) and scores with that win_condition (fallback best-lap for round-less heats).

cargo xtask ci green + new server tests (FirstToLaps / BestConsecutive / fallback).

🤖 Generated with Claude Code

…ondition

The `?projection=result` snapshot was hardcoded to `WinCondition::BestLap` (a #45 placeholder), so
every served heat result was best-lap-ordered regardless of the round's actual win condition. This
drove wrong finishing order in Race control's heat result, the round-robin rotation grid, and the
round-robin points — and made the heat result disagree with the round ranking (which already
re-scores under the round's win condition).

Fix: resolve the heat's round from its `HeatScheduled { round }` tag (same mapping as
completed_heats) + the event meta, and score with that round's `win_condition`; fall back to best-lap
for a round-less (ad-hoc / open-practice) heat. Now FirstToLaps → ReachedAt, BestConsecutive →
BestConsecutiveMicros, Timed → most-laps order, matching the ranking.

cargo xtask ci green (+ new server tests for FirstToLaps / BestConsecutive / no-round fallback).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ryan-johnson2 ryan-johnson2 merged commit a62b8c6 into devel Jun 29, 2026
3 checks passed
@ryan-johnson2 ryan-johnson2 deleted the fix-heat-result-win-condition branch June 29, 2026 01:59
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