1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-31 20:52:21 +01:00

fix bug: validator of reservation can't find if slot has reserved by reservable type

This commit is contained in:
Du Peng 2022-06-29 19:58:53 +02:00
parent 099359e42d
commit a0d158974b
2 changed files with 4 additions and 2 deletions

View File

@ -2,6 +2,8 @@
## next deploy ## next deploy
- Fix a bug: validator of reservation can't find if slot has reserved by reservable type
## v5.4.8 2022 June 29 ## v5.4.8 2022 June 29
- My reservations dashboard - My reservations dashboard

View File

@ -50,8 +50,8 @@ class CartItem::Reservation < CartItem::BaseItem
end end
if availability.available_type == 'machines' if availability.available_type == 'machines'
s = Slot.find_by(start_at: slot[:start_at], end_at: slot[:end_at], availability_id: slot[:availability_id], canceled_at: nil) s = Slot.includes(:reservations).where(start_at: slot[:start_at], end_at: slot[:end_at], availability_id: slot[:availability_id], canceled_at: nil, "reservations.reservable": @reservable)
unless s.nil? unless s.empty?
@errors[:slot] = 'slot is reserved' @errors[:slot] = 'slot is reserved'
return false return false
end end