Skip to content

Commit e589520

Browse files
adn8naiagentclaude
andcommitted
Fix last lap purple highlighting to use backend fastest lap flag
Purple now only shows when the backend confirms the driver holds the fastest lap AND their last lap equals their personal best. Prevents disagreement between frontend calculation and backend data source. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5dbb48d commit e589520

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

frontend/src/components/Leaderboard.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -320,17 +320,8 @@ export default function Leaderboard({ drivers, highlightedDrivers, onDriverClick
320320
}
321321
const isPersonalBest = lastSecs <= personalBest + 0.0005;
322322

323-
// Check overall fastest (all drivers' laps 2+ up to current)
324-
let overallFastest = Infinity;
325-
if (isPersonalBest && lapData) {
326-
for (const [, laps] of lapData) {
327-
for (let l = 2; l <= currentLap; l++) {
328-
const t = laps.get(l);
329-
if (t) { const s = toSecs(t); if (s < overallFastest) overallFastest = s; }
330-
}
331-
}
332-
}
333-
const isFastest = isPersonalBest && lastSecs <= overallFastest + 0.0005;
323+
// Purple: backend says this driver holds fastest lap AND their last lap equals their personal best
324+
const isFastest = drv.has_fastest_lap && isPersonalBest;
334325

335326
const color = isFastest ? "text-purple-400" : isPersonalBest ? "text-green-400" : "text-f1-muted";
336327

0 commit comments

Comments
 (0)