diff --git a/app/controllers/api/bill_controller.rb b/app/controllers/api/bill_controller.rb index 994f6fe4..a4c8b383 100755 --- a/app/controllers/api/bill_controller.rb +++ b/app/controllers/api/bill_controller.rb @@ -47,7 +47,9 @@ class Api::BillController < Api::ApiController Promotion.promo_activate(@sale) #BillBroadcastJob.perform_later(table) - ActionCable.server.broadcast "bill_channel",table: table + if ENV["SERVER_MODE"] != 'cloud' + ActionCable.server.broadcast "bill_channel",table: table + end else @status = false @error_message = "No Current Open Shift" diff --git a/app/controllers/api/call_waiters_controller.rb b/app/controllers/api/call_waiters_controller.rb index b695dc33..d0a0e3df 100644 --- a/app/controllers/api/call_waiters_controller.rb +++ b/app/controllers/api/call_waiters_controller.rb @@ -6,8 +6,9 @@ class Api::CallWaitersController < ActionController::API @time = params[:time] @table = DiningFacility.find(@table_id) # CallWaiterJob.perform_later(@table,@time) - ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time - + if ENV["SERVER_MODE"] != 'cloud' + ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time + end # get printer info @shop = Shop.first unique_code = "CallWaiterPdf" diff --git a/app/controllers/api/order_reserve/order_reservation_controller.rb b/app/controllers/api/order_reserve/order_reservation_controller.rb index 42768d58..486e0c9e 100644 --- a/app/controllers/api/order_reserve/order_reservation_controller.rb +++ b/app/controllers/api/order_reserve/order_reservation_controller.rb @@ -59,8 +59,9 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController order_reservation_id, flag = OrderReservation.addOrderReservationInfo(params) order_reservation = OrderReservation.find(order_reservation_id) - ActionCable.server.broadcast "order_reservation_channel",data: order_reservation - + if ENV["SERVER_MODE"] != 'cloud' + ActionCable.server.broadcast "order_reservation_channel",data: order_reservation + end if flag render :json => { :status => true, :order_reservation_id => order_reservation_id, :message => "Order reservation is successfully created!" } else diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index 05dbdce4..8c1d3a43 100755 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -39,7 +39,9 @@ class Origami::RequestBillsController < ApplicationController # Promotion Activation Promotion.promo_activate(@sale) #bill channel - ActionCable.server.broadcast "bill_channel",table: table + if ENV["SERVER_MODE"] != 'cloud' + ActionCable.server.broadcast "bill_channel",table: table + end if order.source == "quick_service" result = {:status=> @status, :data => @sale.sale_id } render :json => result.to_json diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb index 8cd68d9c..547a8a7e 100755 --- a/app/controllers/origami/split_bill_controller.rb +++ b/app/controllers/origami/split_bill_controller.rb @@ -335,9 +335,9 @@ class Origami::SplitBillController < BaseOrigamiController end Promotion.promo_activate(sale) - - ActionCable.server.broadcast "bill_channel",table: table - + if ENV["SERVER_MODE"] != 'cloud' + ActionCable.server.broadcast "bill_channel",table: table + end render :json => { status: status } else render :json => { status: false, error_message: 'No Current Open Shift!'} diff --git a/app/models/dining_facility.rb b/app/models/dining_facility.rb index 50fc6a52..793ba287 100755 --- a/app/models/dining_facility.rb +++ b/app/models/dining_facility.rb @@ -156,13 +156,17 @@ class DiningFacility < ApplicationRecord table = DiningFacility.find(table_id) #Send to background job for processing # CheckInBookingJob.perform_later(table) - ActionCable.server.broadcast "check_in_booking_channel",table: table + if ENV["SERVER_MODE"] != 'cloud' + ActionCable.server.broadcast "check_in_booking_channel",table: table + end end def self.checkin_time table = DiningFacility.get_checkin_booking if table.length > 0 - ActionCable.server.broadcast "checkin_channel",table: table + if ENV["SERVER_MODE"] != 'cloud' + ActionCable.server.broadcast "checkin_channel",table: table + end end end diff --git a/app/models/order.rb b/app/models/order.rb index e4ab883b..a4f27778 100755 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -321,7 +321,9 @@ class Order < ApplicationRecord end else msg = ' Print Error ! Please contact to service' - ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error' + if ENV["SERVER_MODE"] != 'cloud' + ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error' + end if !sidekiq.nil? OrderQueueProcessorJob.perform_later(self.id, self.table_id) else @@ -335,7 +337,9 @@ class Order < ApplicationRecord end end assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id) - ActionCable.server.broadcast "order_queue_station_channel",order: assign_order + if ENV["SERVER_MODE"] != 'cloud' + ActionCable.server.broadcast "order_queue_station_channel",order: assign_order + end end end @@ -372,7 +376,9 @@ class Order < ApplicationRecord type = 'order' #Send to background job for processing # OrderBroadcastJob.perform_later(table,type) + if ENV["SERVER_MODE"] != 'cloud' ActionCable.server.broadcast "order_channel",table: table,type:type + end end end @@ -526,7 +532,9 @@ class Order < ApplicationRecord end end end - ActionCable.server.broadcast "second_display_channel",data: @data_array,status:@status + if ENV["SERVER_MODE"] != 'cloud' + ActionCable.server.broadcast "second_display_channel",data: @data_array,status:@status + end end private diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 29d755d7..098b5733 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -607,7 +607,9 @@ class SalePayment < ApplicationRecord type = 'payment' #Send to background job for processing # OrderBroadcastJob.perform_later(table,type) - ActionCable.server.broadcast "order_channel",table: table,type:type + if ENV["SERVER_MODE"] != 'cloud' + ActionCable.server.broadcast "order_channel",table: table,type:type + end end end end