check survey shift update

This commit is contained in:
phyusin
2018-06-19 14:03:24 +06:30
parent 1deac0107c
commit 5dbf622401
2 changed files with 29 additions and 7 deletions

View File

@@ -15,9 +15,18 @@ class Api::SurveyController < Api::ApiController
def create
dining_facility = DiningFacility.find(params[:id])
cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
puts params.to_json
# cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
# shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
# puts params.to_json
# set cashier
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
current_shift = ShiftSale.current_shift
if open_cashier.count>0
shift_by_terminal = ShiftSale.current_open_shift(open_cashier[0].id)
else
shift_by_terminal = ShiftSale.current_open_shift(current_shift.employee_id)
end
if params[:survey][:id]>0
survey = Survey.find(params[:survey][:id])
else