From a861f9506abbaab69f7102c45f9024211d3503bd Mon Sep 17 00:00:00 2001 From: bcgov-brwang Date: Tue, 2 Jul 2024 16:11:07 -0700 Subject: [PATCH] DBC22-2333: updated open511 route_at value based on dit data to eliminate other roads label DBC22-2333: updated open511 route_at value based on dit data to eliminate other roads label (cherry picked from commit 6abe05ef4cf8354c15cadfdb163f1236d967948e) --- src/backend/apps/event/tasks.py | 2 ++ src/backend/apps/feed/serializers.py | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/backend/apps/event/tasks.py b/src/backend/apps/event/tasks.py index d8dcc22a..465dded0 100644 --- a/src/backend/apps/event/tasks.py +++ b/src/backend/apps/event/tasks.py @@ -105,6 +105,8 @@ def populate_all_event_data(include_closures=True): event_data["closest_landmark"] = cars_data.get('closest_landmark', '') event_data["next_update"] = cars_data.get('next_update', None) event_data["start_point_linear_reference"] = cars_data.get('start_point_linear_reference', None) + if 'route_at' in cars_data and cars_data['route_at'] != '': + event_data["route_at"] = cars_data['route_at'] # Populate db obj populate_event_from_data(event_data) diff --git a/src/backend/apps/feed/serializers.py b/src/backend/apps/feed/serializers.py index 5003b7e7..25398b26 100644 --- a/src/backend/apps/feed/serializers.py +++ b/src/backend/apps/feed/serializers.py @@ -93,6 +93,7 @@ class CarsEventSerializer(serializers.Serializer): closest_landmark = serializers.CharField(allow_blank=True) next_update = serializers.DateTimeField(allow_null=True) start_point_linear_reference = serializers.FloatField(allow_null=True) + route_at = serializers.CharField(allow_blank=True) def to_internal_value(self, data): data["id"] = data["event-id"] @@ -105,6 +106,7 @@ def to_internal_value(self, data): data["closest_landmark"] = '' data["next_update"] = None data["start_point_linear_reference"] = None + data["route_at"] = '' # Data under "details" for detail in data.get("details", []): @@ -128,6 +130,9 @@ def to_internal_value(self, data): if len(names): data["highway_segment_names"] = names[0] break # No other location data, stop for loop + route_at = location.get("route-designator") + data["route_at"] = route_at + break # Data under "communication-plans" for plan in data.get("communication-plans", []):