Skip to content

Commit

Permalink
fix: only store enhanced trips if they have two or more stops
Browse files Browse the repository at this point in the history
  • Loading branch information
hbruch committed Jan 7, 2025
1 parent f0ac7cf commit c0442bf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion amarillo/services/trips.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ def put_carpool(self, carpool: Carpool):
self.handle_failed_carpool_enhancement(carpool)
return
enhanced_carpool = self.transformer.enhance_carpool(carpool)
# TODO should only store enhanced_carpool, if it has 2 or more stops
if len(enhanced_carpool.stops) < 2:
logger.warning("Failed to add carpool %s:%s to TripStore, less than two stops after enhancement", carpool.agency, carpool.id)
self.handle_failed_carpool_enhancement(carpool)
return
assert_folder_exists(f'data/enhanced/{carpool.agency}/')
with open(filename, 'w', encoding='utf-8') as f:
f.write(enhanced_carpool.json())
Expand Down

0 comments on commit c0442bf

Please sign in to comment.