Skip to content

Commit

Permalink
add specification for serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
princefr committed Jan 7, 2025
1 parent 6bc8efe commit 5908197
Showing 1 changed file with 2 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':
if ret_value == 'WAITING' or (ret_value == 'PARK' and obj.id == 'section_bike_park_1'):
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':
if ret_value == 'WAITING' or (ret_value == 'PARK' and obj.id == 'section_bike_park_1'):
return None
return PlaceSerializer(obj.origin).data

Expand Down

0 comments on commit 5908197

Please sign in to comment.