diff --git a/busManager/coord/context_helpers.py b/busManager/coord/context_helpers.py index 9262a1d..4478fb6 100644 --- a/busManager/coord/context_helpers.py +++ b/busManager/coord/context_helpers.py @@ -59,7 +59,7 @@ def bus_roll_context(queryset=None): }) 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, 'shuttle_count': shuttle_count, 'shuttle_travellers': shuttle_travellers}) + bus_routes.append({'bus': bus, 'traveller_count': traveller_count, 'route_stops': route_stops, 'shuttle_count': shuttle_count, 'shuttle_travellers': shuttle_travellers}) return {'routes': bus_routes} diff --git a/busManager/coord/email_helpers.py b/busManager/coord/email_helpers.py index 671571d..3582a50 100644 --- a/busManager/coord/email_helpers.py +++ b/busManager/coord/email_helpers.py @@ -29,7 +29,7 @@ def email_companies_bus_roll(request, query_set=None): company_route = [] for route in context.get("routes"): - if route.get("company") == company: + if route.get("bus").company == company: company_route.append(route) if not company_route: continue diff --git a/busManager/coord/models.py b/busManager/coord/models.py index 9c9312e..58c9516 100644 --- a/busManager/coord/models.py +++ b/busManager/coord/models.py @@ -241,7 +241,7 @@ class Traveller(models.Model): shuttle = models.ForeignKey(Shuttle, on_delete=models.SET_NULL, blank=True, null=True) class Meta: - ordering = ["last_name"] + ordering = ["last_name", "first_name"] def __str__(self): return f"{self.first_name} {self.last_name}" diff --git a/busManager/coord/templates/reports/bus_roll.html b/busManager/coord/templates/reports/bus_roll.html index e09e914..4c81cf6 100644 --- a/busManager/coord/templates/reports/bus_roll.html +++ b/busManager/coord/templates/reports/bus_roll.html @@ -18,15 +18,15 @@ {% for route in routes %} -
Total Travellers: {{ route.traveller_count }}
- Seating Capacity: {{ route.seating_capacity }}
+ Seating Capacity: {{ route.bus.seating_capacity }}