From 174f3a4a2f108e96a50f5f0c5d5331d189dcab42 Mon Sep 17 00:00:00 2001 From: Francia Csaba Date: Wed, 21 Feb 2024 11:18:34 +0100 Subject: [PATCH] [#1] Only group trips within the same agency --- amarillo/plugins/grfs_export/gtfs_export.py | 5 +++-- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/amarillo/plugins/grfs_export/gtfs_export.py b/amarillo/plugins/grfs_export/gtfs_export.py index d0cee0e..2317e62 100644 --- a/amarillo/plugins/grfs_export/gtfs_export.py +++ b/amarillo/plugins/grfs_export/gtfs_export.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 1422f8a..182bed6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "amarillo-grfs-export" -version = "0.0.2" +version = "0.0.3" dependencies = [ "amarillo", "amarillo-enhancer",