Skip to content

Update: F1 Results#413

Merged
tavdog merged 1 commit intotronbyt:mainfrom
M0ntyP:main
Mar 20, 2026
Merged

Update: F1 Results#413
tavdog merged 1 commit intotronbyt:mainfrom
M0ntyP:main

Conversation

@M0ntyP
Copy link
Contributor

@M0ntyP M0ntyP commented Mar 19, 2026

Updated for 2026 season

Totally forgot about this app 🫤

@M0ntyP M0ntyP requested a review from tavdog as a code owner March 19, 2026 06:33
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request updates the F1 results application to prepare for the 2026 season, ensuring accurate data display for future races. Key improvements include adapting to potential changes in the number of participating drivers, refining how driver names and race statuses are presented, and updating team branding with new and revised constructor colors. These changes enhance the application's robustness and accuracy in reflecting the evolving Formula 1 landscape.

Highlights

  • 2026 Season Update: The application has been updated to reflect the 2026 Formula 1 season, including potential changes in team lineups and driver counts.
  • Increased Driver Capacity: The display logic now accommodates up to 22 drivers, up from 20, to handle potential changes in grid size.
  • Enhanced Driver Name Handling: Specific logic was added to correctly display common names for drivers like Perez and Hulkenberg, improving readability.
  • Improved Race Status Reporting: New status codes for "Did Not Start" (DNS) and "Lapped" (LAP) have been introduced for more comprehensive race results.
  • Updated Team Colors: The Team_Color function was revised to include new constructors like Audi and Cadillac, and updated the color for Haas.
  • Timezone Configuration: A DEFAULT_TIMEZONE constant was added, and time handling logic was adjusted for consistency.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request updates the F1 results application for the 2026 season, including a new DEFAULT_TIMEZONE constant, a change in how now is initialized, and dynamic calculation of total races. It also adjusts several hardcoded loop ranges from 20 to 22, likely to accommodate more drivers, and introduces specific name handling for 'Perez' and 'Hulkenberg'. Additionally, new status codes like 'DNS' and 'LAP' are added for driver results, and team colors are updated to include 'Audi' and 'Cadillac' while removing specific black font handling for 'Haas' and 'Sauber'. Review comments highlight that the DEFAULT_TIMEZONE constant is unused and should be removed, and that the hardcoded 22 in various loop ranges and conditions should be replaced with dynamic lengths derived from the API data to improve robustness. It's also suggested that the if/elif/else block for driver name overrides be refactored into a more scalable dictionary-based approach.

load("schema.star", "schema")
load("time.star", "time")

DEFAULT_TIMEZONE = "Australia/Adelaide"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The constant DEFAULT_TIMEZONE is defined but never used. Unused code should be removed to improve clarity and avoid confusion.

if ShowGap == True:
if ShowGrid == True:
for z in range(0, 20, 4):
for z in range(0, 22, 4):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The loop range is hardcoded with the magic number 22. This makes the code brittle if the number of drivers changes. It's better to get this number dynamically from the data. Since this loop is within if Session == "R":, you can use the length of the race results.

Suggested change
for z in range(0, 22, 4):
for z in range(0, len(F1_JSON["MRData"]["RaceTable"]["Races"][0]["Results"]), 4):

])
elif ShowGrid == False:
for z in range(0, 20, 4):
for z in range(0, 22, 4):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The loop range is hardcoded with the magic number 22. This should be made dynamic based on the number of drivers in the results to make the code more robust against changes in the number of competitors.

Suggested change
for z in range(0, 22, 4):
for z in range(0, len(F1_JSON["MRData"]["RaceTable"]["Races"][0]["Results"]), 4):

elif ShowGap == False:
if ShowGrid == True:
for z in range(0, 20, 4):
for z in range(0, 22, 4):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The loop range is hardcoded with the magic number 22. This should be made dynamic based on the number of drivers in the results to make the code more robust against changes in the number of competitors.

Suggested change
for z in range(0, 22, 4):
for z in range(0, len(F1_JSON["MRData"]["RaceTable"]["Races"][0]["Results"]), 4):

])
elif ShowGrid == False:
for z in range(0, 20, 4):
for z in range(0, 22, 4):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The loop range is hardcoded with the magic number 22. This should be made dynamic based on the number of drivers in the results to make the code more robust against changes in the number of competitors.

Suggested change
for z in range(0, 22, 4):
for z in range(0, len(F1_JSON["MRData"]["RaceTable"]["Races"][0]["Results"]), 4):


if Session == "Q":
for z in range(0, 20, 4):
for z in range(0, 22, 4):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The loop range is hardcoded with the magic number 22. Since this loop is for qualifying results (Session == "Q"), it's better to get the number of drivers dynamically from the qualifying results data to make the code more robust.

Suggested change
for z in range(0, 22, 4):
for z in range(0, len(F1_JSON["MRData"]["RaceTable"]["Races"][0]["QualifyingResults"]), 4):

Comment on lines +318 to +323
if DriverID == "perez":
Driver = "Perez"
elif DriverID == "hulkenberg":
Driver = "Hulkenberg"
else:
Driver = F1_JSON["MRData"]["RaceTable"]["Races"][0][SessionCode][i + z]["Driver"]["familyName"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This if/elif/else block to handle specific driver names is not easily scalable. If more drivers need special name handling, you'll have to keep adding elif clauses. A more maintainable approach is to use a dictionary for these overrides.

For example:

DRIVER_NAME_OVERRIDES = {
    "perez": "Perez",
    "hulkenberg": "Hulkenberg",
}
Driver = DRIVER_NAME_OVERRIDES.get(DriverID, F1_JSON["MRData"]["RaceTable"]["Races"][0][SessionCode][i + z]["Driver"]["familyName"])

The DRIVER_NAME_OVERRIDES dictionary could be defined once as a constant outside the loop.


for i in range(0, 4):
if i + z < 20:
if i + z < 22:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The check i + z < 22 uses a hardcoded magic number 22. This should be based on the actual number of results from the API to avoid issues if the number of drivers changes.

Suggested change
if i + z < 22:
if i + z < len(F1_JSON["MRData"]["RaceTable"]["Races"][0]["Results"]):


for i in range(0, 4):
if i + z < 20:
if i + z < 22:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The check i + z < 22 uses a hardcoded magic number 22. This should be based on the actual number of results from the API to avoid issues if the number of drivers changes.

Suggested change
if i + z < 22:
if i + z < len(F1_JSON["MRData"]["RaceTable"]["Races"][0]["Results"]):

@tavdog tavdog merged commit e464718 into tronbyt:main Mar 20, 2026
1 check passed
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.

2 participants