Save progress

This commit is contained in:
2014-03-30 15:55:22 +02:00
parent e179f6e582
commit 013a41b9f6
71 changed files with 1699 additions and 107 deletions
+11 -1
View File
@@ -2,8 +2,18 @@ module Users
class OrdersController < Users::ApplicationController
respond_to :json
def create
converted_order = params[:order][:product_orders].each_with_object({}){|po, o| o[po[:product_id]] = po[:quantity] }
list = current_user.active_list
unless list = current_user.active_list
table = Table.find(params[:order][:table_id])
if table.occupied?
#render json: json_alert('messages.table_is_occupied', location: :join_occupied_table, location_params: {table_id: @table.id})
render status: :not_acceptable and return
end
list = List.from_table( table, current_user )
end
order = list.place_order converted_order
render json: order, serializer: OrderSerializer
end