From 9b0a564b9a3af8f8c33e7f77ac276e3f36393844 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 25 Apr 2018 13:18:54 +0630 Subject: [PATCH] update cable for cloud --- app/controllers/api/bill_controller.rb | 4 ++-- app/controllers/api/call_waiters_controller.rb | 4 ++-- .../order_reservation_controller.rb | 2 +- app/controllers/origami/addorders_controller.rb | 8 +++----- .../origami/request_bills_controller.rb | 4 ++-- .../origami/second_display_controller.rb | 4 ++-- app/controllers/origami/split_bill_controller.rb | 4 ++-- app/models/dining_facility.rb | 4 ++-- app/models/order.rb | 16 ++++++++-------- app/models/sale_payment.rb | 4 ++-- 10 files changed, 26 insertions(+), 28 deletions(-) diff --git a/app/controllers/api/bill_controller.rb b/app/controllers/api/bill_controller.rb index a4c8b383..2fb3d621 100755 --- a/app/controllers/api/bill_controller.rb +++ b/app/controllers/api/bill_controller.rb @@ -47,9 +47,9 @@ class Api::BillController < Api::ApiController Promotion.promo_activate(@sale) #BillBroadcastJob.perform_later(table) - if ENV["SERVER_MODE"] != 'cloud' + #if ENV["SERVER_MODE"] != 'cloud' ActionCable.server.broadcast "bill_channel",table: table - end + #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 d0a0e3df..b8c11897 100644 --- a/app/controllers/api/call_waiters_controller.rb +++ b/app/controllers/api/call_waiters_controller.rb @@ -6,9 +6,9 @@ class Api::CallWaitersController < ActionController::API @time = params[:time] @table = DiningFacility.find(@table_id) # CallWaiterJob.perform_later(@table,@time) - if ENV["SERVER_MODE"] != 'cloud' + #if ENV["SERVER_MODE"] != 'cloud' ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time - end + #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 61e89c39..89571a9a 100644 --- a/app/controllers/api/order_reserve/order_reservation_controller.rb +++ b/app/controllers/api/order_reserve/order_reservation_controller.rb @@ -61,7 +61,7 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController order_reservation = OrderReservation.find(order_reservation_id) # if ENV["SERVER_MODE"] != 'cloud' - # ActionCable.server.broadcast "order_reservation_channel",data: order_reservation + 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!" } diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index 2eab460a..100635cd 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -184,11 +184,9 @@ puts items_arr.to_json @status, @sale = Sale.request_bill(@order,current_user,current_login_employee) # for second display - if ENV["SERVER_MODE"] != 'cloud' - - ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale" - - end + #if ENV["SERVER_MODE"] != 'cloud' + ActionCable.server.broadcast "second_display_channel",data: @sale,status:"sale" + #end result = {:status=> @status, :data => @sale } render :json => result.to_json end diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index 8c1d3a43..0c50a5da 100755 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -39,9 +39,9 @@ class Origami::RequestBillsController < ApplicationController # Promotion Activation Promotion.promo_activate(@sale) #bill channel - if ENV["SERVER_MODE"] != 'cloud' + #if ENV["SERVER_MODE"] != 'cloud' ActionCable.server.broadcast "bill_channel",table: table - end + #end if order.source == "quick_service" result = {:status=> @status, :data => @sale.sale_id } render :json => result.to_json diff --git a/app/controllers/origami/second_display_controller.rb b/app/controllers/origami/second_display_controller.rb index 611b49a9..ac869719 100644 --- a/app/controllers/origami/second_display_controller.rb +++ b/app/controllers/origami/second_display_controller.rb @@ -13,9 +13,9 @@ class Origami::SecondDisplayController < BaseOrigamiController else tax_profiles = nil end - if ENV["SERVER_MODE"] != 'cloud' + #if ENV["SERVER_MODE"] != 'cloud' ActionCable.server.broadcast "second_display_view_channel",data: params[:data],tax_profiles: tax_profiles,status:params[:status] - end + # end end #Shop Name in Navbor helper_method :shop_detail diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb index 547a8a7e..5f074bb5 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) - if ENV["SERVER_MODE"] != 'cloud' + #if ENV["SERVER_MODE"] != 'cloud' ActionCable.server.broadcast "bill_channel",table: table - end + #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 793ba287..cff5fd60 100755 --- a/app/models/dining_facility.rb +++ b/app/models/dining_facility.rb @@ -156,9 +156,9 @@ class DiningFacility < ApplicationRecord table = DiningFacility.find(table_id) #Send to background job for processing # CheckInBookingJob.perform_later(table) - if ENV["SERVER_MODE"] != 'cloud' + #if ENV["SERVER_MODE"] != 'cloud' ActionCable.server.broadcast "check_in_booking_channel",table: table - end + #end end def self.checkin_time diff --git a/app/models/order.rb b/app/models/order.rb index a4f27778..01a7b583 100755 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -321,9 +321,9 @@ class Order < ApplicationRecord end else msg = ' Print Error ! Please contact to service' - if ENV["SERVER_MODE"] != 'cloud' + #if ENV["SERVER_MODE"] != 'cloud' ActionCable.server.broadcast "call_waiter_channel",table: msg,time:'print_error' - end + #end if !sidekiq.nil? OrderQueueProcessorJob.perform_later(self.id, self.table_id) else @@ -337,9 +337,9 @@ class Order < ApplicationRecord end end assign_order = AssignedOrderItem.assigned_order_item_by_job(self.id) - if ENV["SERVER_MODE"] != 'cloud' + #if ENV["SERVER_MODE"] != 'cloud' ActionCable.server.broadcast "order_queue_station_channel",order: assign_order - end + #end end end @@ -376,9 +376,9 @@ class Order < ApplicationRecord type = 'order' #Send to background job for processing # OrderBroadcastJob.perform_later(table,type) - if ENV["SERVER_MODE"] != 'cloud' + #if ENV["SERVER_MODE"] != 'cloud' ActionCable.server.broadcast "order_channel",table: table,type:type - end + #end end end @@ -532,9 +532,9 @@ class Order < ApplicationRecord end end end - if ENV["SERVER_MODE"] != 'cloud' + #if ENV["SERVER_MODE"] != 'cloud' ActionCable.server.broadcast "second_display_channel",data: @data_array,status:@status - end + #end end private diff --git a/app/models/sale_payment.rb b/app/models/sale_payment.rb index 098b5733..3dba0a9b 100755 --- a/app/models/sale_payment.rb +++ b/app/models/sale_payment.rb @@ -607,9 +607,9 @@ class SalePayment < ApplicationRecord type = 'payment' #Send to background job for processing # OrderBroadcastJob.perform_later(table,type) - if ENV["SERVER_MODE"] != 'cloud' + #if ENV["SERVER_MODE"] != 'cloud' ActionCable.server.broadcast "order_channel",table: table,type:type - end + #end end end end