mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-03-15 12:29:16 +01:00
(bug) unable to generate subscription statistics
Can't join 'InvoiceItem' to association named 'subscription'
This commit is contained in:
parent
93e2eb7192
commit
3f935adeb2
@ -126,16 +126,11 @@ class StatisticService
|
||||
|
||||
def subscriptions_list(options = default_options)
|
||||
result = []
|
||||
InvoiceItem.where('invoice_items.created_at >= :start_date AND invoice_items.created_at <= :end_date', options)
|
||||
.eager_load(invoice: [:coupon], subscription: [:plan, statistic_profile: [:group]]).each do |i|
|
||||
InvoiceItem.where("object_type = #{Subscription.name} invoice_items.created_at >= :start_date AND invoice_items.created_at <= :end_date", options)
|
||||
.eager_load(invoice: [:coupon], object: [:plan, statistic_profile: [:group]]).each do |i|
|
||||
next if i.invoice.is_a?(Avoir)
|
||||
next unless i.invoice_item_type == Subscription.name
|
||||
|
||||
sub = if i.object_type == Subscription.name
|
||||
i.object
|
||||
else
|
||||
i.object.subscription
|
||||
end
|
||||
sub = i.object
|
||||
|
||||
ca = i.amount.to_i
|
||||
cs = CouponService.new
|
||||
|
Loading…
x
Reference in New Issue
Block a user