Commit 60799c69 by ivan Lan

Add round 2 to order amount

parent eb799753
......@@ -106,23 +106,21 @@ module Shotengai
end
def set_amount
self.update!(amount: product_amount + delivery_cost)
self.update!(amount: (product_amount + delivery_cost).round(2))
end
def amount
read_attribute(:amount) || product_amount + delivery_cost
read_attribute(:amount) || (product_amount + delivery_cost).round(2)
end
def product_amount
snapshots.sum(&:total_price)
snapshots.sum(&:total_price).round(2)
end
def product_original_amount
snapshots.sum(&:total_original_price)
snapshots.sum(&:total_original_price).round(2)
end
# into order
def incr_snapshot_ids= ids
ActiveRecord::Base.transaction do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment