From e5e904e989db8733ee909f51c7c2df4d2cd3fda7 Mon Sep 17 00:00:00 2001 From: phyusin Date: Thu, 7 Dec 2017 15:29:05 +0630 Subject: [PATCH] change orange color func: --- app/models/dining_facility.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/dining_facility.rb b/app/models/dining_facility.rb index 2c712f7c..7b67b4af 100755 --- a/app/models/dining_facility.rb +++ b/app/models/dining_facility.rb @@ -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_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}' and checkin_by is null").limit(1) if booking.count > 0 then return booking[0] else @@ -85,7 +85,8 @@ 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_hr <= hr) && (checkout_at_min <= 15) + + if checkout_at_min <= 15 return booking end end