Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

give the latest forecast creation time #144

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pv_site_api/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ def forecast_rows_to_pydantic(rows: list[Row]) -> list[Forecast]:
data[site_uuid]["forecast_creation_datetime"] = row.ForecastSQL.timestamp_utc
data[site_uuid]["forecast_version"] = row.ForecastSQL.forecast_version

# make sure we use the latest forecast_creation_datetime
if row.ForecastSQL.timestamp_utc > data[site_uuid]["forecast_creation_datetime"]:
data[site_uuid]["forecast_creation_datetime"] = row.ForecastSQL.timestamp_utc

fv_uuid = row.ForecastValueSQL.forecast_value_uuid

if fv_uuid not in fv_uuids[site_uuid]:
Expand Down
Loading