Small fix if there are multiple identical stops in a same trip

This commit is contained in:
Emmy D'Anello 2024-02-16 18:05:20 +01:00
parent d679aadf68
commit 9f3c031851
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

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