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( Booking.objects.filter(primary_booking__in=bookings_to_cancel).update(
cancellation_datetime=cancellation_datetime cancellation_datetime=cancellation_datetime
) )
cancelled_events = [ if payload.get('include_booked_events_detail'):
get_short_event_detail( cancelled_events = [
request, get_short_event_detail(
events_by_id[x.event_id], request,
multiple_agendas=True, events_by_id[x.event_id],
) multiple_agendas=True,
for x in bookings_to_cancel )
] for x in bookings_to_cancel
]
cancelled_count = bookings_to_cancel.update(cancellation_datetime=cancellation_datetime) cancelled_count = bookings_to_cancel.update(cancellation_datetime=cancellation_datetime)
# and delete outdated cancelled bookings # and delete outdated cancelled bookings
Booking.objects.filter( Booking.objects.filter(