From 768b5d7e0e9255f32b83399dcb384f042f796ed2 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Mon, 24 Jul 2023 18:13:34 +0200 Subject: [PATCH] (bug) cannot create slot --- app/services/slots/reservations_service.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/services/slots/reservations_service.rb b/app/services/slots/reservations_service.rb index 913764bf1..8dd890662 100644 --- a/app/services/slots/reservations_service.rb +++ b/app/services/slots/reservations_service.rb @@ -19,7 +19,9 @@ class Slots::ReservationsService .where('reservations.reservable_type': reservable_types) .where('reservations.reservable_id': reservables.map { |r| r.try(:id) }) .where('slots_reservations.canceled_at': nil) - reservations = reservations.where('slots_reservations.is_valid': true) if reservables.first&.pre_registration? + if reservables.first.is_a?(Event) && reservables.first&.pre_registration? + reservations = reservations.where('slots_reservations.is_valid': true) + end user_ids = reservations.includes(reservation: :statistic_profile) .map(&:reservation)