From 2cd86890fa87de82daca38079060e9c856bac9df Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 5 Dec 2017 18:10:01 +0630 Subject: [PATCH] checkin get method update --- app/controllers/api/check_in_process_controller.rb | 2 +- app/models/dining_facility.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/check_in_process_controller.rb b/app/controllers/api/check_in_process_controller.rb index 7b60f7cc..5360db5b 100644 --- a/app/controllers/api/check_in_process_controller.rb +++ b/app/controllers/api/check_in_process_controller.rb @@ -3,7 +3,7 @@ class Api::CheckInProcessController < Api::ApiController def check_in_time if params[:dining_id] dining_facility = DiningFacility.find(params[:dining_id]) - booking = dining_facility.get_booking + booking = dining_facility.get_current_checkout_booking if !booking.nil? check_in_time = booking.checkin_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") check_out_time = booking.checkout_at.utc.getlocal.strftime("%Y-%m-%d %H:%M") diff --git a/app/models/dining_facility.rb b/app/models/dining_facility.rb index 1130003e..36f5cf7b 100755 --- a/app/models/dining_facility.rb +++ b/app/models/dining_facility.rb @@ -67,7 +67,7 @@ class DiningFacility < ApplicationRecord end def get_current_checkout_booking - booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and sale_id is null and checkout_at is not null and checkout_by is null").limit(1) + booking = Booking.where("dining_facility_id = #{self.id} and booking_status ='assign' and sale_id is not null").limit(1) if booking.count > 0 then return booking[0] else