Added shuttles to bus roll

This commit is contained in:
John Mullins
2023-09-05 11:14:42 +10:00
parent c55471a298
commit 86a3ad139d
2 changed files with 23 additions and 3 deletions
+9 -2
View File
@@ -34,9 +34,16 @@ def bus_roll_context(queryset=None):
}
bus_route.append(stop_result)
# Todo Add shuttles
shuttle_travellers = []
has_shuttle = False
for shuttle in Shuttle.objects.filter(bus=bus):
has_shuttle = True
for traveller in Traveller.objects.filter(shuttle=shuttle):
shuttle_travellers.append({
'display': f"{traveller} ({traveller.get_year_level_display()}, {traveller.school})",
})
bus_routes.append({'bus': bus, 'stops': bus_route})
bus_routes.append({'bus': bus, 'stops': bus_route, 'has_shuttle': has_shuttle, 'shuttle_travellers': shuttle_travellers})
return {'routes': bus_routes}