diff --git a/busManager/coord/context_helpers.py b/busManager/coord/context_helpers.py index 4da4a39..9262a1d 100644 --- a/busManager/coord/context_helpers.py +++ b/busManager/coord/context_helpers.py @@ -50,15 +50,16 @@ def bus_roll_context(queryset=None): }) shuttle_travellers = [] - has_shuttle = False + shuttle_count = 0 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})", - }) + if traveller.is_active(): + shuttle_travellers.append({ + 'display': f"{traveller} ({traveller.get_year_level_display()}, {traveller.school})", + }) + shuttle_count += 1 - bus_routes.append({'route_name': bus.route_name, 'company': bus.company, 'traveller_count': traveller_count, 'seating_capacity': bus.seating_capacity, 'route_stops': route_stops, 'has_shuttle': has_shuttle, 'shuttle_travellers': shuttle_travellers}) + bus_routes.append({'route_name': bus.route_name, 'company': bus.company, 'traveller_count': traveller_count, 'seating_capacity': bus.seating_capacity, 'route_stops': route_stops, 'shuttle_count': shuttle_count, '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 7fe377b..e09e914 100644 --- a/busManager/coord/templates/reports/bus_roll.html +++ b/busManager/coord/templates/reports/bus_roll.html @@ -75,8 +75,12 @@
{% endfor %}

- {% if route.has_shuttle %} + {% if route.shuttle_count > 0 %}

{{ route.route_name }} (Shuttle)

+

+ Total Travellers: {{ route.shuttle_count }}
+ Seating Capacity: {{ route.seating_capacity }} +

{% for traveller in route.shuttle_travellers %}