1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

(bug) event reserved places compute error

This commit is contained in:
Du Peng 2023-07-24 14:08:12 +02:00
parent 7ba596c9b8
commit 5e46d8c45e
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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,