test no table

This commit is contained in:
Aung Myo
2018-02-14 14:26:36 +06:30
parent 08e372cfb5
commit b2cec95064
3 changed files with 14 additions and 11 deletions

View File

@@ -23,9 +23,8 @@ class Order < ApplicationRecord
def generate
booking = nil
if self.new_booking
if !self.table_id.nil?
if self.table_id.to_i > 0
table_id = self.table_id
else
table_id = nil
@@ -43,7 +42,7 @@ class Order < ApplicationRecord
end
#end extra time
if !self.table_id.nil?
if self.table_id.to_i > 0
table = DiningFacility.find(self.table_id)
table.status = "occupied"
table.save
@@ -324,11 +323,13 @@ class Order < ApplicationRecord
#send order items and send to order queue
def send_order_broadcast(booking)
table = DiningFacility.find(booking.dining_facility_id)
type = 'order'
#Send to background job for processing
# OrderBroadcastJob.perform_later(table,type)
ActionCable.server.broadcast "order_channel",table: table,type:type
if self.table_id.to_i > 0
table = DiningFacility.find(booking.dining_facility_id)
type = 'order'
#Send to background job for processing
# OrderBroadcastJob.perform_later(table,type)
ActionCable.server.broadcast "order_channel",table: table,type:type
end
end
#Origami: Cashier : to view order Table