Qwaiter supplier on Ember 1.0

This commit is contained in:
2013-09-30 17:49:22 +02:00
parent 6d7647c2c5
commit 8ea2e79dc2
44 changed files with 378 additions and 156 deletions
+4 -3
View File
@@ -1,5 +1,6 @@
class Order
include SimplyStored::Couch
include ActiveModel::SerializerSupport
property :state, default: 'placed' # placed, active, delivered, cancelled, closed
@@ -115,9 +116,9 @@ class Order
ho[:product_orders] = []
order_total = 0.0
for product_order in product_orders
order_total += (product_order.amount * product_order.price).round(2)
ho[:products] << {name: product_order.product.name, id: product_order.product_id, number: product_order.amount, price: product_order.price}
ho[:product_orders] << {product_name: product_order.product.name, id: product_order.id, quantity: product_order.amount, price: product_order.price}
order_total += (product_order.quantity * product_order.price).round(2)
ho[:products] << {name: product_order.product.name, id: product_order.product_id, number: product_order.quantity, price: product_order.price}
ho[:product_orders] << {product_name: product_order.product.name, id: product_order.id, quantity: product_order.quantity, price: product_order.price}
end
ho[:total_amount] = order_total.round(2)
@with_products_as_json = ho