diff --git a/busManager/coord/context_helpers.py b/busManager/coord/context_helpers.py index e5d895f..f77913d 100644 --- a/busManager/coord/context_helpers.py +++ b/busManager/coord/context_helpers.py @@ -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} diff --git a/busManager/coord/templates/reports/bus_roll.html b/busManager/coord/templates/reports/bus_roll.html index f4e9928..34783d3 100644 --- a/busManager/coord/templates/reports/bus_roll.html +++ b/busManager/coord/templates/reports/bus_roll.html @@ -1,5 +1,7 @@