api: don't build details if not requested (#77590)

This commit is contained in:
Lauréline Guérin 2023-05-24 14:43:00 +02:00 committed by Lauréline Guérin
parent 2d2052f91c
commit 11559acd35
1 changed files with 9 additions and 8 deletions

View File

@ -1867,14 +1867,15 @@ class RecurringFillslots(APIView):
Booking.objects.filter(primary_booking__in=bookings_to_cancel).update(
cancellation_datetime=cancellation_datetime
)
cancelled_events = [
get_short_event_detail(
request,
events_by_id[x.event_id],
multiple_agendas=True,
)
for x in bookings_to_cancel
]
if payload.get('include_booked_events_detail'):
cancelled_events = [
get_short_event_detail(
request,
events_by_id[x.event_id],
multiple_agendas=True,
)
for x in bookings_to_cancel
]
cancelled_count = bookings_to_cancel.update(cancellation_datetime=cancellation_datetime)
# and delete outdated cancelled bookings
Booking.objects.filter(