Skip to content

Commit 34d98ce

Browse files
committed
DBC22-6531: added end location to location_description
1 parent cc78bc6 commit 34d98ce

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

src/backend/apps/feed/serializers.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,16 +219,23 @@ def to_internal_value(self, data):
219219

220220
else: # All other non-chainup events
221221
locations_data = data.get("location", {})
222-
start_location = locations_data.get('start', {})
223-
if start_location:
222+
223+
# Description from start and end points and their nearby locations
224+
location_description = ''
225+
for location_key in ('start', 'end'):
226+
start_or_end = locations_data.get(location_key, {})
227+
if not start_or_end:
228+
continue
229+
224230
# route_at - was "route-designator" but now "name"
225-
data['route_at'] = start_location.get('name', '')
231+
data['route_at'] = start_or_end.get('name', '')
226232

227233
# closest_landmark / location_description
228-
nearby_locations = start_location.get('nearby', [])
229-
if nearby_locations and len(nearby_locations) > 0:
230-
location_description = ''
231-
for loc in nearby_locations:
234+
nearby_locs = start_or_end.get('nearby', [])
235+
if nearby_locs and len(nearby_locs) > 0:
236+
location_description += 'Starts: ' if location_key == 'start' else '<br><br>Ends: '
237+
238+
for loc in nearby_locs:
232239
if not data.get('closest_landmark') and (loc.get('name') or loc.get('phrase')):
233240
data["closest_landmark"] = loc.get('name') or loc.get('phrase')
234241

@@ -237,7 +244,7 @@ def to_internal_value(self, data):
237244

238245
location_description += loc.get('phrase', '')
239246

240-
data["location_description"] = location_description
247+
data["location_description"] = location_description
241248

242249
# next_update
243250
timing = data.get("timing", {})

0 commit comments

Comments
 (0)