mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-18 07:52:23 +01:00
fix statistic generation with cash coupons
This commit is contained in:
parent
fd93f3cefd
commit
1ebab285f3
@ -127,7 +127,7 @@ class StatisticService
|
|||||||
if sub
|
if sub
|
||||||
ca = i.amount.to_i / 100.0
|
ca = i.amount.to_i / 100.0
|
||||||
unless i.invoice.coupon_id.nil?
|
unless i.invoice.coupon_id.nil?
|
||||||
ca = CouponApplyService.new(ca, i.invoice.coupon)
|
ca = CouponApplyService.new.(ca, i.invoice.coupon)
|
||||||
end
|
end
|
||||||
u = sub.user
|
u = sub.user
|
||||||
p = sub.plan
|
p = sub.plan
|
||||||
@ -353,7 +353,7 @@ class StatisticService
|
|||||||
end
|
end
|
||||||
# subtract coupon discount from invoices and refunds
|
# subtract coupon discount from invoices and refunds
|
||||||
unless invoice.coupon_id.nil?
|
unless invoice.coupon_id.nil?
|
||||||
ca = CouponApplyService.new(ca, invoice.coupon)
|
ca = CouponApplyService.new.(ca, invoice.coupon)
|
||||||
end
|
end
|
||||||
# divide the result by 100 to convert from centimes to monetary unit
|
# divide the result by 100 to convert from centimes to monetary unit
|
||||||
ca == 0 ? ca : ca / 100.0
|
ca == 0 ? ca : ca / 100.0
|
||||||
@ -366,7 +366,7 @@ class StatisticService
|
|||||||
end
|
end
|
||||||
# subtract coupon discount from the refund
|
# subtract coupon discount from the refund
|
||||||
unless invoice.coupon_id.nil?
|
unless invoice.coupon_id.nil?
|
||||||
ca = CouponApplyService.new(ca, invoice.coupon)
|
ca = CouponApplyService.new.(ca, invoice.coupon)
|
||||||
end
|
end
|
||||||
ca == 0 ? ca : ca / 100.0
|
ca == 0 ? ca : ca / 100.0
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user