Skip to content

Commit

Permalink
(bug) event canceled places error
Browse files Browse the repository at this point in the history
  • Loading branch information
gnepud committed Feb 23, 2024
1 parent 51c4e02 commit f8edc5b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion app/models/slots_reservation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit f8edc5b

Please sign in to comment.