Skip to content

Commit

Permalink
DBC22-2333: updated open511 route_at value based on dit data to elimi…
Browse files Browse the repository at this point in the history
…nate other roads label

DBC22-2333: updated open511 route_at value based on dit data to eliminate other roads label
(cherry picked from commit 6abe05e)
  • Loading branch information
bcgov-brwang authored and ray-oxd committed Aug 1, 2024
1 parent 7c78167 commit a861f95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/backend/apps/event/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions src/backend/apps/feed/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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", []):
Expand All @@ -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", []):
Expand Down

0 comments on commit a861f95

Please sign in to comment.