fix(results): score heat-result projection with the round's win condition (not hardcoded best-lap)#318
Merged
Conversation
…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>
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.
?projection=resultwas hardcoded toWinCondition::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 itsHeatScheduledtag + event meta) and scores with thatwin_condition(fallback best-lap for round-less heats).cargo xtask cigreen + new server tests (FirstToLaps / BestConsecutive / fallback).🤖 Generated with Claude Code