From 9f3c0318519cf372ddff1c14e853ff8313e50500 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Fri, 16 Feb 2024 18:05:20 +0100 Subject: [PATCH] Small fix if there are multiple identical stops in a same trip --- sncfgtfs/management/commands/update_sncf_gtfs_rt.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sncfgtfs/management/commands/update_sncf_gtfs_rt.py b/sncfgtfs/management/commands/update_sncf_gtfs_rt.py index 7830feb..6eeda6e 100644 --- a/sncfgtfs/management/commands/update_sncf_gtfs_rt.py +++ b/sncfgtfs/management/commands/update_sncf_gtfs_rt.py @@ -194,8 +194,12 @@ class Command(BaseCommand): st.drop_off_type = 1 st.save() else: - st = StopTime.objects.get(Q(stop=stop_id) | Q(stop__parent_station_id=stop_id), - trip_id=trip_id) + qs = StopTime.objects.filter(Q(stop=stop_id) | Q(stop__parent_station_id=stop_id), + trip_id=trip_id) + if qs.count() == 1: + st = qs.first() + else: + st = qs.get(stop_sequence=stop_sequence) if st.stop_sequence != stop_sequence: st.stop_sequence = stop_sequence st.save()