diff --git a/chrono/api/views.py b/chrono/api/views.py index a559fd7c..af723343 100644 --- a/chrono/api/views.py +++ b/chrono/api/views.py @@ -3096,7 +3096,7 @@ class BookingsStatistics(APIView): raise APIErrorBadRequest(N_('invalid statistics filters'), errors=serializer.errors) data = serializer.validated_data - bookings = Booking.objects + bookings = Booking.objects.filter(cancellation_datetime__isnull=True) if 'start' in data: bookings = bookings.filter(event__start_datetime__gte=data['start']) if 'end' in data: diff --git a/tests/api/test_statistics.py b/tests/api/test_statistics.py index 30732c21..b7242182 100644 --- a/tests/api/test_statistics.py +++ b/tests/api/test_statistics.py @@ -47,6 +47,7 @@ def test_statistics_bookings(app, user, freezer): for _ in range(10): Booking.objects.create(event=event1) + Booking.objects.create(event=event1, cancellation_datetime=now()) Booking.objects.create(event=event2) resp = app.get(url + '?time_interval=day')