Stahovani pocasi, drobne upravy
This commit is contained in:
@@ -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))
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user