Commit 60799c69 by ivan Lan

Add round 2 to order amount

parent eb799753
...@@ -106,22 +106,20 @@ module Shotengai ...@@ -106,22 +106,20 @@ module Shotengai
end end
def set_amount def set_amount
self.update!(amount: product_amount + delivery_cost) self.update!(amount: (product_amount + delivery_cost).round(2))
end end
def amount def amount
read_attribute(:amount) || product_amount + delivery_cost read_attribute(:amount) || (product_amount + delivery_cost).round(2)
end end
def product_amount def product_amount
snapshots.sum(&:total_price) snapshots.sum(&:total_price).round(2)
end end
def product_original_amount def product_original_amount
snapshots.sum(&:total_original_price) snapshots.sum(&:total_original_price).round(2)
end end
# into order # into order
def incr_snapshot_ids= ids def incr_snapshot_ids= ids
......
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