change checkout time and free time

This commit is contained in:
phyusin
2017-12-14 16:40:29 +06:30
parent fc45198542
commit ed429b2d4b
4 changed files with 39 additions and 28 deletions

View File

@@ -1,20 +1,15 @@
class Origami::CheckInProcessController < BaseOrigamiController
def check_in_process
dining_charge = DiningCharge.select('charge_type','charge_block')
.where('dining_facility_id = ?',params[:dining_id])
.first()
lookup_checkout_time = Lookup.collection_of("checkout_time")
checkout_at = Time.now.utc
if !dining_charge.nil?
hr = (dining_charge.charge_block.utc.strftime("%H").to_i).to_int
min = (dining_charge.charge_block.utc.strftime("%M").to_i).to_int
# if dining_charge.charge_type == 'hr'
checkout_at = checkout_at + hr.hour + min.minutes
# else
# end
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
end
end
@dining_facility = DiningFacility.find(params[:dining_id])
@dining_facility.status = "occupied"