feat: include simulation start and end timestamps in forecast response message

main
Cizz22 3 months ago
parent 074fdf1276
commit 216e42206e

@ -1,3 +1,4 @@
from datetime import timedelta
from collections import defaultdict from collections import defaultdict
from datetime import datetime from datetime import datetime
import io import io
@ -529,6 +530,9 @@ async def get_forecast_eaf(
# Using the helper from utils.py # Using the helper from utils.py
offset_hours = hours_between(oh_date, now) offset_hours = hours_between(oh_date, now)
#start date is oh + offset
start_date = oh_date + timedelta(hours=offset_hours)
# 4. Define Forecast Window # 4. Define Forecast Window
duration = 168 if time_range == "weekly" else 720 duration = 168 if time_range == "weekly" else 720
@ -578,7 +582,7 @@ async def get_forecast_eaf(
"sim_duration_hours": duration, "sim_duration_hours": duration,
"reference_oh_date": oh_date_str "reference_oh_date": oh_date_str
}, },
message="Forecast generated successfully" message=f"Forecast generated successfully, start date: {start_date.strftime('%Y-%m-%d %H:%M:%S')}, end_date: {(start_date + timedelta(hours=duration)).strftime('%Y-%m-%d %H:%M:%S')}"
) )
except Exception as e: except Exception as e:
import logging import logging

Loading…
Cancel
Save