diff --git a/app/models/dining_facility.rb b/app/models/dining_facility.rb index 36f5cf7b..2c712f7c 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 sale_id is not null").limit(1) + booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and checkin_by is null").limit(1) if booking.count > 0 then return booking[0] else @@ -81,14 +81,11 @@ class DiningFacility < ApplicationRecord now = Time.now.utc hr = (now.strftime("%H").to_i).to_int min = (now.strftime("%M").to_i).to_int - checkout_at = booking.checkout_at.utc - - checkout_at = checkout_at - hr.hour - checkout_at = checkout_at - min.minutes - checkout_at = checkout_at.utc.strftime("%M").to_i - - if checkout_at <= 15 + 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) return booking end end diff --git a/app/views/origami/home/show.html.erb b/app/views/origami/home/show.html.erb index f479fdd5..6368ede9 100755 --- a/app/views/origami/home/show.html.erb +++ b/app/views/origami/home/show.html.erb @@ -37,10 +37,14 @@