Cleanup code
This commit is contained in:
+3
-2
@@ -295,9 +295,10 @@ class List
|
||||
orders_placed_count = supplier.increment_orders_placed_count!
|
||||
loaded_products = self.class.database.load_document products.keys
|
||||
products.each do |product_id, quantity|
|
||||
quantity = quantity.to_i
|
||||
product = loaded_products.find{|p| p.id == product_id} # to get the price
|
||||
ProductOrder.create order: order, product_id: product_id, quantity: quantity, price: product.price, product_name: product.name if quantity > 0
|
||||
if quantity.to_i > 0
|
||||
ProductOrder.create(order: order, product_id: product_id, quantity: quantity, price: product.price, product_name: product.name)
|
||||
end
|
||||
end
|
||||
set_price
|
||||
save
|
||||
|
||||
Reference in New Issue
Block a user