From de20436e8b52248f935cabc1847023db2d2d6c85 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 8 Aug 2018 17:46:01 +0630 Subject: [PATCH] update order in quick service without dinign --- app/models/sale.rb | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/app/models/sale.rb b/app/models/sale.rb index 4dcbba14..19fcd662 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -84,12 +84,12 @@ class Sale < ApplicationRecord # current cashier login open_cashier = Employee.where("role = 'cashier' AND token_session <> ''") current_shift = ShiftSale.current_shift - # shift with terminal zone - table = DiningFacility.find(booking.dining_facility_id) - cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id) + # shift with terminal zone # set cashier if order_source.downcase == "emenu" + table = DiningFacility.find(booking.dining_facility_id) + cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id) shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and cashier_terminal_id = #{cashier_zone.cashier_terminal_id}").first #for multiple zone with terminal if shift.nil? @@ -112,8 +112,6 @@ class Sale < ApplicationRecord else if open_cashier.count>0 # if we have two open cashier # table and terminal in multiple shift - shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null and cashier_terminal_id = #{cashier_zone.cashier_terminal_id}").first - if shift.nil? self.cashier_id = open_cashier[0].id self.cashier_name = open_cashier[0].name shift_id = ShiftSale.current_open_shift(open_cashier[0].id) @@ -122,11 +120,6 @@ class Sale < ApplicationRecord else self.shift_sale_id = current_shift.id end - else - self.cashier_id = shift.employee_id - self.cashier_name = Employee.find(shift.employee_id).name - self.shift_sale_id = shift.id - end else self.cashier_id = current_shift.employee_id self.cashier_name = Employee.find(current_shift.employee_id).name