Skip to content

Add fastest lap highlight to leaderboard - #253

Open
rawad-yared wants to merge 1 commit into
IAmTomShaw:mainfrom
rawad-yared:feature/fastest-lap-highlight
Open

Add fastest lap highlight to leaderboard#253
rawad-yared wants to merge 1 commit into
IAmTomShaw:mainfrom
rawad-yared:feature/fastest-lap-highlight

Conversation

@rawad-yared

@rawad-yared rawad-yared commented Mar 13, 2026

Copy link
Copy Markdown

Summary

  • Adds dynamic fastest lap tracking during race replay — the driver holding the fastest lap is highlighted with a purple background on the leaderboard, matching the official F1 broadcast style
  • The fastest lap holder updates in real-time as faster laps are set throughout the race
  • Computes lap completion times from FastF1 session data and walks through frames chronologically so the highlight appears at the correct moment

Changes

  • src/f1_data.py — New _compute_fastest_lap_holders() function that embeds fastest_lap data (driver, formatted time, lap number) into each frame
  • src/interfaces/race_replay.py — Passes fastest lap info from frame data to the window for leaderboard access
  • src/ui_components.py — Renders purple highlight (background + text) for the fastest lap holder in LeaderboardComponent

Test plan

  • Tested with 2025 Bahrain GP (Round 4) — fastest lap holder highlighted correctly
  • Verify with races that have late fastest laps (e.g., drivers pitting for softs on final lap)
  • Verify with sprint races
  • Confirm cached data works after first --refresh-data run

Dynamically tracks which driver holds the fastest lap during the race
and highlights them with a purple background on the leaderboard, matching
the official F1 broadcast style. The fastest lap holder updates in
real-time as faster laps are set throughout the race.
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