Conversation
Summary of ChangesHello, 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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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" |
| if ShowGap == True: | ||
| if ShowGrid == True: | ||
| for z in range(0, 20, 4): | ||
| for z in range(0, 22, 4): |
There was a problem hiding this comment.
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.
| 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): |
There was a problem hiding this comment.
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.
| 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): |
There was a problem hiding this comment.
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.
| 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): |
There was a problem hiding this comment.
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.
| 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): |
There was a problem hiding this comment.
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.
| for z in range(0, 22, 4): | |
| for z in range(0, len(F1_JSON["MRData"]["RaceTable"]["Races"][0]["QualifyingResults"]), 4): |
| if DriverID == "perez": | ||
| Driver = "Perez" | ||
| elif DriverID == "hulkenberg": | ||
| Driver = "Hulkenberg" | ||
| else: | ||
| Driver = F1_JSON["MRData"]["RaceTable"]["Races"][0][SessionCode][i + z]["Driver"]["familyName"] |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
|
|
||
| for i in range(0, 4): | ||
| if i + z < 20: | ||
| if i + z < 22: |
There was a problem hiding this comment.
Updated for 2026 season
Totally forgot about this app 🫤