Nested polymorphic hour building legs and stops added, needs restyling

This commit is contained in:
2025-11-21 15:25:29 +01:00
parent bcdc885d66
commit 02990d4b2f
9 changed files with 124 additions and 51 deletions

View File

@@ -10,7 +10,7 @@ from typing import List
from ..models.weekpref import WeekPreference
from ..models.missions import Training
from ..models.hourbuildings import HourBuilding,HourBuildingLeg
from ..models.hourbuildings import HourBuilding, HourBuildingLegFlight, HourBuildingLegStop
def export_selected(request: HttpRequest, queryset: QuerySet[WeekPreference]) -> HttpResponse:
@@ -121,9 +121,9 @@ def export_selected(request: HttpRequest, queryset: QuerySet[WeekPreference]) ->
hb_name if h.sunday else ""
]
hb_notes = f"{h.notes}\n----\n" if h.notes else ""
hb_legs = HourBuildingLeg.objects.filter(hb_id = h.id)
for hh in hb_legs:
hb_notes += f"{hh.departure} -> {hh.destination} [{hh.time}]\n" if not hh.stop else f"STOP at {hh.departure} [{hh.time}]\n"
hb_legs = HourBuildingLegFlight.objects.filter(hb_id = h.id)
#for hh in hb_legs:
# hb_notes += f"{hh.departure} -> {hh.destination} [{hh.time}]\n" if not hh.stop else f"STOP at {hh.departure} [{hh.time}]\n"
hb_notes.strip('\n')
hb_data.append([str(q.week), *student_data, *hb_days, str(q.student.phone), q.student.email, hb_notes])