mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-20 14:54:15 +01:00
(bug) unable to reserve a machine slot when another machine was already reserved on the same slot
This commit is contained in:
parent
10a918ced7
commit
7432bb848e
@ -16,7 +16,11 @@ class Slot < ApplicationRecord
|
||||
availability_places = availability.available_places_per_slot(reservable)
|
||||
return false if availability_places.nil?
|
||||
|
||||
slots_reservations.where(canceled_at: nil).count >= availability_places
|
||||
if reservable.nil?
|
||||
slots_reservations.where(canceled_at: nil).count >= availability_places
|
||||
else
|
||||
slots_reservations.includes(:reservation).where(canceled_at: nil).where('reservations.reservable': reservable).count >= availability_places
|
||||
end
|
||||
end
|
||||
|
||||
def duration
|
||||
|
Loading…
x
Reference in New Issue
Block a user