1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00

(bug) fix generate statistics

This commit is contained in:
Sylvain 2022-03-23 17:27:04 +01:00
parent 6e97336005
commit 1b21453adc

View File

@ -126,9 +126,7 @@ class StatisticService
def subscriptions_list(options = default_options)
result = []
join_clause = "INNER JOIN suscriptions ON invoice_items.object_id = suscriptions.id AND invoice_items.object_type = '#{Subscription.name}'"
InvoiceItem.joins(join_clause)
.where("object_type = #{Subscription.name} invoice_items.created_at >= :start_date AND invoice_items.created_at <= :end_date", options)
InvoiceItem.where("object_type = '#{Subscription.name}' AND invoice_items.created_at >= :start_date AND invoice_items.created_at <= :end_date", options)
.eager_load(invoice: [:coupon]).each do |i|
next if i.invoice.is_a?(Avoir)