Skip to content

Commit

Permalink
FIX: session results for Sprint Quali in 2024 not calculated (#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
theOehrly committed Jun 10, 2024
1 parent 34a1eee commit c81d6ce
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions fastf1/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2291,16 +2291,23 @@ def _get_data():
return self._ergast.get_race_results(
self.event.year, self.event.RoundNumber
)

elif session_name == 'Qualifying':
return self._ergast.get_qualifying_results(
self.event.year, self.event.RoundNumber
)
elif session_name in ('Sprint', 'Sprint Qualifying'):

# double condition because of reuse of the "Sprint Qualifying" name
# for a race-like session in 2018 and a quali-like session in 2024+
# Ergast only supports the race-like sprint results.
elif ('Sprint' in session_name
and session_name in self._RACE_LIKE_SESSIONS):
return self._ergast.get_sprint_results(
self.event.year, self.event.RoundNumber
)

else:
# TODO: Use Ergast when/if it supports sprint shootout sessions
# TODO: Use Ergast when it supports quali-like sprint results
# return self._ergast.get_sprint_shootout_results(
# self.event.year, self.event.RoundNumber
# )
Expand All @@ -2309,8 +2316,15 @@ def _get_data():
response = _get_data()

if not response or not response.content:
_logger.warning("No result data for this session available on "
"Ergast! (This is expected for recent sessions)")
if (('Sprint' in session_name)
and (session_name in self._QUALI_LIKE_SESSIONS)):
_logger.warning(f"{session_name} is not supported by "
f"Ergast! Limited results are calculated from "
f"timing data.")
else:
_logger.warning("No result data for this session available on "
"Ergast! (This is expected for recent "
"sessions)")
return None

data = response.content[0]
Expand Down

0 comments on commit c81d6ce

Please sign in to comment.