Take delay into account in the next departures/arrivals tables

This commit is contained in:
Emmy D'Anello 2024-02-10 20:35:00 +01:00
parent 28faf5ad10
commit 72e00ae781
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 4 additions and 4 deletions

View File

@ -177,14 +177,14 @@ class NextDeparturesViewSet(viewsets.ReadOnlyModelViewSet):
~Q(update__departure_time=datetime.fromtimestamp(0)))
qs_today = StopTime.objects.filter(stop_filter) \
.filter(Q(departure_time__gte=query_time)) \
.filter(Q(departure_time__gte=query_time - F('update__departure_delay'))) \
.filter(Q(pickup_type=0) | canceled_filter(query_date)) \
.filter(calendar_filter(query_date)) \
.annotate(departure_date=Value(query_date)) \
.annotate(departure_time_24h=F('departure_time'))
qs_yesterday = StopTime.objects.filter(stop_filter) \
.filter(Q(departure_time__gte=time_yesterday)) \
.filter(Q(departure_time__gte=time_yesterday - F('update__departure_delay'))) \
.filter(Q(pickup_type=0) | canceled_filter(yesterday)) \
.filter(calendar_filter(yesterday)) \
.annotate(departure_date=Value(yesterday)) \
@ -249,14 +249,14 @@ class NextArrivalsViewSet(viewsets.ReadOnlyModelViewSet):
~Q(update__arrival_time=datetime.fromtimestamp(0)))
qs_today = StopTime.objects.filter(stop_filter) \
.filter(Q(departure_time__gte=query_time)) \
.filter(Q(departure_time__gte=query_time - F('update__arrival_delay'))) \
.filter(Q(drop_off_type=0) | canceled_filter(query_date)) \
.filter(calendar_filter(query_date)) \
.annotate(arrival_date=Value(query_date)) \
.annotate(arrival_time_24h=F('arrival_time'))
qs_yesterday = StopTime.objects.filter(stop_filter) \
.filter(Q(departure_time__gte=time_yesterday)) \
.filter(Q(departure_time__gte=time_yesterday - F('update__arrival_delay'))) \
.filter(Q(drop_off_type=0) | canceled_filter(yesterday)) \
.filter(calendar_filter(yesterday)) \
.annotate(arrival_date=Value(yesterday)) \