Stahovani pocasi, drobne upravy

This commit is contained in:
Michal Kváček
2024-05-27 22:30:44 +02:00
parent 94613a5b1b
commit ba5e73108f
13 changed files with 293 additions and 26 deletions
+22
View File
@@ -0,0 +1,22 @@
from sqlalchemy import select
from database import models
from database.transaction import get_session
class FlighPlanWeather:
@staticmethod
async def get_plans() -> list:
async with get_session() as db:
markers_without_weather = (await db.execute(
select(models.FlightPlanMarker).filter(models.FlightPlanMarker.weather_info_id.is_(None))
))
flight_plan_ids = {m.flight_plan_id for m in markers_without_weather}
if not flight_plan_ids:
return []
return (await db.execute(
select(models.FlightPlan, models.FlightPlan.markers)
.filter(models.FlightPlan.id.in_(flight_plan_ids))
))