From 60172160bf2ae74d85845cb753f75ea5a97a89cb Mon Sep 17 00:00:00 2001 From: John Mullins Date: Mon, 26 Aug 2024 14:30:15 +1000 Subject: [PATCH] Fixed address and added active status to route context --- busManager/coord/context_helpers.py | 37 +++++++++++++++++------------ 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/busManager/coord/context_helpers.py b/busManager/coord/context_helpers.py index a7fedaa..d186a2e 100644 --- a/busManager/coord/context_helpers.py +++ b/busManager/coord/context_helpers.py @@ -137,22 +137,29 @@ def school_travellerRoute_context(school): def traveller_route_context(traveller_route): traveller = traveller_route.traveller bus_stop = traveller_route.busStop + families = traveller.get_families() + address = "" + for family in families: + if address: + address += ";" + address = address + f"{family.residential_address} {family.residential_suburb}" return { - 'first_name': traveller.first_name, - 'last_name': traveller.last_name, - 'school': traveller.school, - 'dob': traveller.dob, - 'year_level': traveller.year_level, - 'address': f"{traveller.residential_address} {traveller.residential_suburb}", - 'start_date': traveller.travel_start_date, - 'end_date': traveller.travel_end_date, - 'eligibility': traveller.get_eligibility_status_display(), - 'shuttle': traveller.shuttle, - 'route': traveller_route.busStop.bus, - 'stop': f"#{bus_stop.get_stop_number()} - {bus_stop.address}", - 'pickup': bus_stop.am_time, - 'drop-off': bus_stop.pm_time - } + 'first_name': traveller.first_name, + 'last_name': traveller.last_name, + 'active': traveller.is_active, + 'school': traveller.school, + 'dob': traveller.dob, + 'year_level': traveller.year_level, + 'address': address, + 'start_date': traveller.travel_start_date, + 'end_date': traveller.travel_end_date, + 'eligibility': traveller.get_eligibility_status_display(), + 'shuttle': traveller.shuttle, + 'route': traveller_route.busStop.bus, + 'stop': f"#{bus_stop.get_stop_number()} - {bus_stop.address}", + 'pickup': bus_stop.am_time, + 'drop-off': bus_stop.pm_time + } def emergency_contacts_context(queryset=None):