diff --git a/CHANGELOG.md b/CHANGELOG.md index 2373005fe..85fdc1ed0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog Fab-manager +- Fix a bug: event reserved places compute error +- [TODO DEPLOY] `rails fablab:setup:build_places_cache` + ## v6.0.11 2023 July 21 - Fix a bug: incorrect date range in statistics diff --git a/app/services/slots/places_cache_service.rb b/app/services/slots/places_cache_service.rb index 65a19b733..789728700 100644 --- a/app/services/slots/places_cache_service.rb +++ b/app/services/slots/places_cache_service.rb @@ -32,7 +32,11 @@ class Slots::PlacesCacheService reserved_places = (reservations[:reservations].count || 0) + (pending[:reservations].count || 0) if slot.availability.available_type == 'event' - reserved_places = slot.availability.event.nb_total_places - slot.availability.event.nb_free_places + reserved_places = if slot.availability.event.nb_total_places.nil? + 0 + else + slot.availability.event.nb_total_places - slot.availability.event.nb_free_places + end end places.push({ reservable_type: reservable.class.name,