diff --git a/src/aeros_simulation/router.py b/src/aeros_simulation/router.py index 8154ffd..c4d32f5 100644 --- a/src/aeros_simulation/router.py +++ b/src/aeros_simulation/router.py @@ -533,8 +533,8 @@ async def get_forecast_eaf( # 4. Define Forecast Window duration = 168 if time_range == "weekly" else 720 - start_date = oh_date + timedelta(hours=offset_hours) - end_date = start_date + timedelta(hours=duration) + start_date = oh_date + end_date = now + timedelta(hours=duration) project = await get_project(db_session=db_session) # 5. Create Simulation Request diff --git a/src/dashboard_model/service.py b/src/dashboard_model/service.py index 2a91eec..8f84f6b 100644 --- a/src/dashboard_model/service.py +++ b/src/dashboard_model/service.py @@ -180,7 +180,7 @@ async def get_latest_sim_results_by_pattern(db_session: DbSession, pattern: str) trip_query = select(AerosSimulationCalcResult).join(AerosNode).where( AerosSimulationCalcResult.aeros_simulation_id == simulation.id, AerosNode.node_type == 'RegularNode' - ).order_by(AerosSimulationCalcResult.num_events.desc()).limit(5) + ).options(selectinload(AerosSimulationCalcResult.aeros_node)).order_by(AerosSimulationCalcResult.num_events.desc()).limit(5) trip_res_exec = await db_session.execute(trip_query) trip_results = trip_res_exec.scalars().all()