Skip to content

Commit e74068d

Browse files
check propulsion_type
1 parent ca858f9 commit e74068d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/converters/gbfs_nextbike_set_range_properties.py

+6
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,18 @@ def convert(self, data: Union[dict, list], path: str) -> Union[dict, list]:
1212

1313
if path.endswith('/vehicle_types.json'):
1414
for vehicle_type in data['data'].get('vehicle_types', []):
15+
if 'propulsion_type' not in vehicle_type or vehicle_type['propulsion_type'] == 'human':
16+
continue
1517
if 'max_range_meters' not in vehicle_type or vehicle_type['max_range_meters'] == 0:
1618
vehicle_type['max_range_meters'] = 60000
1719
return data
1820

1921
if path.endswith('/free_bike_status.json'):
2022
for bike in data['data'].get('bikes', []):
23+
if 'vehicle_type_id' not in bike:
24+
continue
25+
# vehicle_type_id = bike['vehicle_type_id']
26+
# check if vehicle_type has propulsion_type != human
2127
if 'current_range_meters' not in bike or bike['current_range_meters'] == 0:
2228
bike['current_range_meters'] = 1000
2329
return data

0 commit comments

Comments
 (0)