From d35aa23e3463ef7b9ded78d98d1e4608ac4d035b Mon Sep 17 00:00:00 2001 From: Yan Date: Wed, 28 Jun 2017 16:17:56 +0630 Subject: [PATCH] still dev to respond code for order --- app/controllers/api/orders_controller.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/orders_controller.rb b/app/controllers/api/orders_controller.rb index 1eba8c56..2fb61b1f 100644 --- a/app/controllers/api/orders_controller.rb +++ b/app/controllers/api/orders_controller.rb @@ -67,13 +67,19 @@ class Api::OrdersController < Api::ApiController if booking if booking.dining_facility_id.to_i == params[:table_id].to_i && booking.booking_status != 'moved' if !booking.sale_id.nil? - check_order_with_booking(booking) + sale_status = check_order_with_booking(booking) + if sale_status + return false + end else @order.new_booking = false @order.booking_id = params[:booking_id] end else - check_order_with_table(params[:table_id]) + sale_status = check_order_with_table(params[:table_id]) + if sale_status + return false + end end end #booking exists else @@ -90,9 +96,11 @@ class Api::OrdersController < Api::ApiController if booking if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed" @order.new_booking = true + return true else @order.new_booking = false @order.booking_id = booking.booking_id + return false end end end @@ -101,9 +109,11 @@ class Api::OrdersController < Api::ApiController def check_order_with_booking(booking) if booking.sale.sale_status == "completed" || booking.sale.sale_status == "billed" @order.new_booking = true + return true else @order.new_booking = false @order.booking_id = params[:booking_id] + return false end end # Description