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()