Skip to content

Use best lap time as tiebreaker for same-time finishes#527

Merged
agateau merged 1 commit intoagateau:masterfrom
evanofficial:fix/same-time-finish-ranking
Apr 18, 2026
Merged

Use best lap time as tiebreaker for same-time finishes#527
agateau merged 1 commit intoagateau:masterfrom
evanofficial:fix/same-time-finish-ranking

Conversation

@evanofficial
Copy link
Copy Markdown
Contributor

Fixes #468

When two racers finish with the exact same total time, compareRaceDistances() returns 0 (equal). This causes inconsistent ranking between the HUD (which counts racers ahead via iteration) and the results screen (which sorts racers, reordering ties unpredictably).

Added a best-lap-time tiebreaker: when total times are equal, the racer with the faster best lap is ranked higher. This gives a deterministic result regardless of sort stability or array order.

@agateau
Copy link
Copy Markdown
Owner

agateau commented Apr 18, 2026

Hi Evan, thanks for this fix. Looks like a very rare edge case. Does it happen often to you?

@agateau agateau added the skip-changelog Used on PR to indicate changes which do not require a changelog entry label Apr 18, 2026
@agateau agateau enabled auto-merge April 18, 2026 19:13
@agateau agateau merged commit 0ed0376 into agateau:master Apr 18, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-changelog Used on PR to indicate changes which do not require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Finishing in the same millisecond makes ranks incoherent

2 participants