diff --git a/CHANGELOG.md b/CHANGELOG.md index a6be6ef51..04f7b1390 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## Next release - improvement: add idp_slo_service_url(logout requests url) to saml provider +- Fix a bug: event canceled places error +- [TODO DEPLOY] `rails fablab:setup:build_places_cache` ## v6.3.13 2024 February 19 diff --git a/app/models/slots_reservation.rb b/app/models/slots_reservation.rb index f81ef4c59..9fb35d500 100644 --- a/app/models/slots_reservation.rb +++ b/app/models/slots_reservation.rb @@ -66,10 +66,13 @@ def remove_from_places_cache(target_slot = slot) # @param target_slot [Slot] def update_places_cache(operation, target_slot = slot) if reservation.reservable_type == 'Event' + total_booked_seats = reservation.nb_reserve_places + total_booked_seats += reservation.tickets.map(&:booked).map(&:to_i).reduce(:+) if reservation.tickets.count.positive? + total_booked_seats = 0 if reservation.reservable.pre_registration Slots::PlacesCacheService.change_places(target_slot, reservation.reservable_type, reservation.reservable_id, - reservation.reservable.pre_registration ? 0 : reservation.total_booked_seats, + total_booked_seats, operation) else Slots::PlacesCacheService.change_places(target_slot, reservation.reservable_type, reservation.reservable_id, 1, operation)