diff --git a/app/models/dining_facility.rb b/app/models/dining_facility.rb index 53a08e61..4159372a 100755 --- a/app/models/dining_facility.rb +++ b/app/models/dining_facility.rb @@ -81,12 +81,14 @@ 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_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 + if !booking.checkout_at.nil? + checkout_at = booking.checkout_at.utc + 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 end end