add current login name in checkin process

This commit is contained in:
phyusin
2017-12-07 16:26:11 +06:30
parent ed75030f57
commit 51ecc653f1
3 changed files with 6 additions and 7 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}' and checkin_by is null").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}'").limit(1)
if booking.count > 0 then
return booking[0]
else
@@ -85,8 +85,7 @@ class DiningFacility < ApplicationRecord
checkout_at_hr = (checkout_at.utc.strftime("%H").to_i).to_int
checkout_at_min = (checkout_at.utc.strftime("%M").to_i).to_int
checkout_at_min -= min
if checkout_at_min <= 15
if (checkout_at_hr <= hr) && (checkout_at_min <= 15)
return booking
end
end