add fun: for checkin and checkout

This commit is contained in:
phyusin
2017-12-08 10:14:28 +06:30
parent 485eef3782
commit 46bbd90df5
6 changed files with 38 additions and 14 deletions

View File

@@ -67,7 +67,7 @@ class DiningFacility < ApplicationRecord
end
def get_current_checkout_booking
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}'").limit(1)
booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_at between '#{DateTime.now.utc - 5.hours}' and '#{DateTime.now.utc}' and reserved_by is not null").limit(1)
if booking.count > 0 then
return booking[0]
else