Skip to content

Commit 97ea180

Browse files
committed
Address error int he quantity_year_to_date method where we were getting huge amounts
1 parent 3dfb654 commit 97ea180

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

app/models/partner.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,8 @@ def register_on_partnerbase
5353

5454
def quantity_year_to_date
5555
distributions
56-
.includes(items: :line_items)
56+
.includes(:line_items)
5757
.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)
58+
.references(:line_items).map(&:line_items).flatten.sum(&:quantity)
6159
end
6260
end

0 commit comments

Comments
 (0)