pull origin master

This commit is contained in:
Yan
2017-09-18 13:53:28 +06:30
parent 4f3b831771
commit 8966f290b5
122 changed files with 3964 additions and 2277 deletions

View File

@@ -0,0 +1,7 @@
class BillBroadcastJob < ApplicationJob
queue_as :default
def perform(table)
ActionCable.server.broadcast "bill_channel",table: table
end
end

View File

@@ -1,9 +1,7 @@
class OrderBroadcastJob < ApplicationJob
queue_as :default
def perform(message)
order = Order.find(message) # message come as order_id
ApplicationCable.server.broadcast "order_queue_station_channel", order: order
def perform(table)
ActionCable.server.broadcast "order_channel",table: table
end
end

View File

@@ -4,14 +4,24 @@ class OrderQueueProcessorJob < ApplicationJob
def perform(order_id, table_id)
# Do something later
#Order ID
order = Order.find(order_id)
#Loop through the order stations and process the items
order = Order.find(order_id)
assign_order = AssignedOrderItem.assigned_order_item_by_job(order_id)
#Execute orders and send to order stations
if order
oqs = OrderQueueStation.new
oqs.process_order(order, table_id)
end
ActionCable.server.broadcast "order_queue_station_channel",order: assign_order
end
# private
# def render_order(assign_order)
# ApplicationController.renderer.render(partial: 'oqs/oqs_test',
# locals: { order: assign_order})
# end
# Read more at https://www.pluralsight.com/guides/ruby-ruby-on-rails/creating-a-chat-using-rails-action-cable#TehYiuqlHDOXaQQk.99
end