api: do not count cancelled bookings in statistics (#68044)
This commit is contained in:
parent
1250edcdfc
commit
cb409ebb5b
|
@ -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:
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue