mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-21 15:54:22 +01:00
fix a rounding error with coupons
This commit is contained in:
parent
0e7226c85c
commit
d1584604b3
@ -25,7 +25,7 @@ class CouponService
|
|||||||
unless coupon_object.nil?
|
unless coupon_object.nil?
|
||||||
if coupon_object.status(user_id, total) == 'active'
|
if coupon_object.status(user_id, total) == 'active'
|
||||||
if coupon_object.type == 'percent_off'
|
if coupon_object.type == 'percent_off'
|
||||||
price -= price * coupon_object.percent_off / 100.00
|
price -= (price * coupon_object.percent_off / 100.00).truncate
|
||||||
elsif coupon_object.type == 'amount_off'
|
elsif coupon_object.type == 'amount_off'
|
||||||
# do not apply cash coupon unless it has a lower amount that the total price
|
# do not apply cash coupon unless it has a lower amount that the total price
|
||||||
price -= coupon_object.amount_off if coupon_object.amount_off <= price
|
price -= coupon_object.amount_off if coupon_object.amount_off <= price
|
||||||
|
Loading…
x
Reference in New Issue
Block a user