Skip to content

Commit 7b3a929

Browse files
committed
fix
1 parent 26bf323 commit 7b3a929

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nowcasting_datamodel/update.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ def update_all_forecast_latest(forecasts: List[ForecastSQL], session: Session):
125125
forecast_historic = [
126126
forecast for forecast in forecasts_historic if forecast.location.gsp_id == gsp_id
127127
]
128-
forecast_historic = forecast_historic[0]
128+
if len(forecast_historic) == 0:
129+
forecast_historic = None
130+
else:
131+
forecast_historic = forecast_historic[0]
129132

130133
update_forecast_latest(
131134
forecast=forecast, session=session, forecast_historic=forecast_historic

0 commit comments

Comments
 (0)