Skip to content

Commit

Permalink
update serializer and comment function
Browse files Browse the repository at this point in the history
  • Loading branch information
princefr committed Jan 9, 2025
1 parent 5908197 commit 6581fbf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def get_to(self, obj):
if obj.HasField(str('type')):
enum = obj.DESCRIPTOR.fields_by_name['type'].enum_type.values_by_number
ret_value = enum[getattr(obj, 'type')].name
if ret_value == 'WAITING' or (ret_value == 'PARK' and obj.id == 'section_bike_park_1'):
if ret_value == 'WAITING' or (ret_value == 'PARK' and 'section_bike_park' in obj.id):
return None
return PlaceSerializer(obj.destination).data

Expand All @@ -377,7 +377,7 @@ def get__from(self, obj):
if obj.HasField(str('type')):
enum = obj.DESCRIPTOR.fields_by_name['type'].enum_type.values_by_number
ret_value = enum[getattr(obj, 'type')].name
if ret_value == 'WAITING' or (ret_value == 'PARK' and obj.id == 'section_bike_park_1'):
if ret_value == 'WAITING' or (ret_value == 'PARK' and 'section_bike_park' in obj.id):
return None
return PlaceSerializer(obj.origin).data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,9 @@ def _update_fallback_with_bike_mode(
[fallback_sections[-1].street_network.path_items[-1]]
)
fallback_sections[-1].street_network.path_items.pop()
# update the duration and length of the sections
# the duration and length of the target section is the duration and length of the access point
# the duration and length of the fallback section is the duration and length of the street network minus the duration and length of the access point
target_section.duration = via_pt_access.access_point.traversal_time
target_section.length = via_pt_access.access_point.length
fallback_sections[-1].duration -= via_pt_access.access_point.traversal_time
Expand Down

0 comments on commit 6581fbf

Please sign in to comment.