change query for dashboard and time for checkin channel

This commit is contained in:
phyusin
2017-12-13 18:30:04 +06:30
parent 211db16311
commit 32dac8e9a8
4 changed files with 19 additions and 12 deletions

View File

@@ -78,15 +78,18 @@ class DiningFacility < ApplicationRecord
def get_checkout_booking
booking = self.get_current_checkout_booking
if booking
now = Time.now.utc.getlocal
now = Time.now.utc
puts now
hr = (now.strftime("%H").to_i).to_int
min = (now.strftime("%M").to_i).to_int
if !booking.checkout_at.nil?
checkout_at = booking.checkout_at.utc.getlocal
checkout_at = booking.checkout_at.utc
checkout_at_hr = (checkout_at.strftime("%H").to_i).to_int
checkout_at_min = (checkout_at.strftime("%M").to_i).to_int
checkout_at_min -= min
if (checkout_at_hr <= hr) && (checkout_at_min <= 15)
if (checkout_at_hr < hr)
return booking
elsif (checkout_at_hr == hr && checkout_at_min <= 15)
return booking
else
return nil
@@ -110,7 +113,9 @@ class DiningFacility < ApplicationRecord
checkout_at_hr = (checkout_at.strftime("%H").to_i).to_int
checkout_at_min = (checkout_at.strftime("%M").to_i).to_int
checkout_at_min -= min
if (checkout_at_hr <= hr) && (checkout_at_min <= 15)
if (checkout_at_hr < hr)
arr_booking.push({'table_id' => booking.dining_facility_id})
elsif (checkout_at_hr == hr && checkout_at_min <= 15)
arr_booking.push({'table_id' => booking.dining_facility_id})
end
end