[#1] Only group trips within the same agency
All checks were successful
Amarillo/amarillo-gitea/amarillo-grfs-export/pipeline/head This commit looks good

This commit is contained in:
Csaba 2024-02-21 11:18:34 +01:00
parent 2c1190adb6
commit 174f3a4a2f
2 changed files with 4 additions and 3 deletions

View file

@ -103,8 +103,9 @@ class GtfsExport:
current_trip.route_id = current_route_id
for other_id, other_trip in list(ungrouped_trips.items()):
# if an ungrouped trip is close to any of the grouped trips, add it to the route group
if (any(self.trips_are_close(other_trip, grouped_trip) for grouped_trip in current_group.values())):
# if an ungrouped trip is from the same agency close to any of the grouped trips, add it to the route group
# TODO: it should be possible to optimize this
if (any(grouped_trip.agency == other_trip.agency and self.trips_are_close(other_trip, grouped_trip) for grouped_trip in current_group.values())):
current_group[other_id] = ungrouped_trips.pop(other_id)
current_group[other_id].route_id = current_route_id

View file

@ -1,6 +1,6 @@
[project]
name = "amarillo-grfs-export"
version = "0.0.2"
version = "0.0.3"
dependencies = [
"amarillo",
"amarillo-enhancer",