change checkout time and checkout alert time process

This commit is contained in:
phyusin
2018-01-16 10:15:28 +06:30
parent dc2637ed39
commit ca98efc756
4 changed files with 70 additions and 27 deletions

View File

@@ -3,12 +3,14 @@ class Origami::CheckInProcessController < BaseOrigamiController
def check_in_process
lookup_checkout_time = Lookup.collection_of("checkout_time")
checkout_at = Time.now.utc
if !lookup_checkout_time.nil?
if lookup_checkout_time[0][0] == 'hr'
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.hour
else
checkout_at = checkout_at + (lookup_checkout_time[0][1]).to_i.minutes
lookup_checkout_time.each do |checkout_time|
arr_time = checkout_time[0].split("-")
start_time = Time.parse(arr_time[0].strip).utc.strftime("%H:%M%p")
end_time = Time.parse(arr_time[1].strip).utc.strftime("%H:%M%p")
if start_time <= checkout_at && checkout_at <= end_time
checkout_at = checkout_at + (checkout_time[1]).to_i.minutes
end
end
end
@dining_facility = DiningFacility.find(params[:dining_id])