change dynamic checkin checkout

This commit is contained in:
phyusin
2018-11-20 18:10:48 +06:30
parent cd33da68fa
commit d641a09d41
5 changed files with 155 additions and 51 deletions

View File

@@ -179,5 +179,24 @@ class DiningFacility < ApplicationRecord
end
end
end
def check_time(time, booking = nil, type)
status = true
today = Time.now.utc
check_time = Time.parse(time.strip).utc
if type.downcase == "checkin"
if check_time < today
status = false
end
else
if !booking.nil?
checkin_at = booking.checkin_at.utc
if check_time <= checkin_at
status = false
end
end
end
return status
end
end