User specs in the green
This commit is contained in:
@@ -35,6 +35,10 @@ class DashboardController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def empty_page
|
||||
render text: ''
|
||||
end
|
||||
|
||||
|
||||
# GET /select_qr_image
|
||||
# GET /select_qr_image.png
|
||||
|
||||
@@ -137,6 +137,23 @@ module Suppliers
|
||||
head :no_content
|
||||
end
|
||||
|
||||
# POST /list/:id/change_table?to_table=:table_id
|
||||
def change_table
|
||||
res = {}
|
||||
status = 200
|
||||
@list = List.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
|
||||
@table = Table.find(params[:table_id])
|
||||
res[:table_is_from_other_supplier] = true unless @table.supplier_id == @list.supplier_id
|
||||
res[:table_occupied] = true if @table.occupied?
|
||||
unless res[:table_is_from_other_supplier] or res[:table_occupied]
|
||||
res[:ok] = true
|
||||
@list.move_to_table! @table
|
||||
else
|
||||
res[:ok] = false
|
||||
end
|
||||
render json: res
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def list_params
|
||||
|
||||
@@ -75,7 +75,8 @@ module Users
|
||||
list = List.from_table( table, current_user )
|
||||
res[:active_list_id] = list.id # used to set the active list in the app
|
||||
order = list.place_order product_orders: product_orders, user: current_user, first_order: true
|
||||
res[:payload] = JSONAPI::Serializer.serialize(order, serializer: Users::OrderSerializer, include: %w[list list.users product_orders])
|
||||
res[:supplier_orders_placed_count] = list.supplier.orders_placed_count
|
||||
res[:payload] = Users::OrderSerializer.serialize(order, include: %w[list list.users product_orders])
|
||||
end
|
||||
render json: res
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user