1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

fix statistic generation with cash coupons

This commit is contained in:
Sylvain 2016-11-29 12:07:22 +01:00
parent fd93f3cefd
commit 1ebab285f3

View File

@ -127,7 +127,7 @@ class StatisticService
if sub
ca = i.amount.to_i / 100.0
unless i.invoice.coupon_id.nil?
ca = CouponApplyService.new(ca, i.invoice.coupon)
ca = CouponApplyService.new.(ca, i.invoice.coupon)
end
u = sub.user
p = sub.plan
@ -353,7 +353,7 @@ class StatisticService
end
# subtract coupon discount from invoices and refunds
unless invoice.coupon_id.nil?
ca = CouponApplyService.new(ca, invoice.coupon)
ca = CouponApplyService.new.(ca, invoice.coupon)
end
# divide the result by 100 to convert from centimes to monetary unit
ca == 0 ? ca : ca / 100.0
@ -366,7 +366,7 @@ class StatisticService
end
# subtract coupon discount from the refund
unless invoice.coupon_id.nil?
ca = CouponApplyService.new(ca, invoice.coupon)
ca = CouponApplyService.new.(ca, invoice.coupon)
end
ca == 0 ? ca : ca / 100.0
end