We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3dfb654 commit 97ea180Copy full SHA for 97ea180
app/models/partner.rb
@@ -53,10 +53,8 @@ def register_on_partnerbase
53
54
def quantity_year_to_date
55
distributions
56
- .includes(items: :line_items)
+ .includes(:line_items)
57
.where("line_items.created_at > ?", Time.zone.today.beginning_of_year)
58
- .references(items: :line_items).map do |distribution|
59
- distribution.items.map(&:line_items)
60
- end.flatten.sum(&:quantity)
+ .references(:line_items).map(&:line_items).flatten.sum(&:quantity)
61
end
62
0 commit comments