From bc2d6e07f10e676d867b1d663728f592801d52dd Mon Sep 17 00:00:00 2001 From: phyusin Date: Tue, 16 Jan 2018 14:59:47 +0630 Subject: [PATCH] check empty for checkout time and checkout alert time --- app/controllers/api/check_in_process_controller.rb | 2 +- app/controllers/origami/check_in_process_controller.rb | 2 +- app/models/dining_facility.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/check_in_process_controller.rb b/app/controllers/api/check_in_process_controller.rb index 7ad00d67..883fb1ea 100644 --- a/app/controllers/api/check_in_process_controller.rb +++ b/app/controllers/api/check_in_process_controller.rb @@ -15,7 +15,7 @@ class Api::CheckInProcessController < Api::ApiController lookup_checkout_time = Lookup.collection_of("checkout_alert_time") alert_time_min = 0 - if !lookup_checkout_time.nil? + if !lookup_checkout_time.empty? now = Time.now.utc lookup_checkout_time.each do |checkout_time| arr_time = checkout_time[0].split("-") diff --git a/app/controllers/origami/check_in_process_controller.rb b/app/controllers/origami/check_in_process_controller.rb index 40a28398..14d5c90c 100644 --- a/app/controllers/origami/check_in_process_controller.rb +++ b/app/controllers/origami/check_in_process_controller.rb @@ -3,7 +3,7 @@ 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.empty? 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") diff --git a/app/models/dining_facility.rb b/app/models/dining_facility.rb index 1feab5d9..c4da3475 100755 --- a/app/models/dining_facility.rb +++ b/app/models/dining_facility.rb @@ -80,7 +80,7 @@ class DiningFacility < ApplicationRecord if booking lookup_checkout_time = Lookup.collection_of("checkout_alert_time") free_time_min = 0 - if !lookup_checkout_time.nil? + if !lookup_checkout_time.empty? now = Time.now.utc lookup_checkout_time.each do |checkout_time| arr_time = checkout_time[0].split("-") @@ -119,7 +119,7 @@ class DiningFacility < ApplicationRecord if bookings lookup_checkout_time = Lookup.collection_of("checkout_alert_time") free_time_min = 0 - if !lookup_checkout_time.nil? + if !lookup_checkout_time.empty? now = Time.now.utc lookup_checkout_time.each do |checkout_time| arr_time = checkout_time[0].split("-")