Added traveller count to shuttle roll and removed inactive from roll
This commit is contained in:
@@ -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}
|
||||
|
||||
|
||||
|
||||
@@ -75,8 +75,12 @@
|
||||
<br>
|
||||
{% endfor %}
|
||||
<p style="page-break-after: always">
|
||||
{% if route.has_shuttle %}
|
||||
{% if route.shuttle_count > 0 %}
|
||||
<h1 style="font-size: 2.5em">{{ route.route_name }} (Shuttle)</h1>
|
||||
<p style="text-align:right; font-size:12px">
|
||||
Total Travellers: {{ route.shuttle_count }}<br>
|
||||
Seating Capacity: {{ route.seating_capacity }}
|
||||
</p>
|
||||
<table class="traveller">
|
||||
{% for traveller in route.shuttle_travellers %}
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user