Skip to content

Commit

Permalink
Merge pull request #931 from CommitChange/fix-issue-with-recurring-do…
Browse files Browse the repository at this point in the history
…nations

Fix queries to payments on recurring donations
  • Loading branch information
wwahammy authored Oct 1, 2024
2 parents 1349feb + e177991 commit 4390e30
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/legacy_lib/query_supporters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,10 @@ def self.full_filter_expr(np_id, query)
end

if query[:recurring].present?
rec_ps_subquery = Qx.select("payments.count", "payments.supporter_id")
rec_ps_subquery = Qx.select("nonprofit_payments.count", "nonprofit_payments.supporter_id")
.from(:nonprofit_payments)
.where("kind='RecurringDonation'")
.group_by("payments.supporter_id")
.group_by("nonprofit_payments.supporter_id")
.as(:rec_ps)
expr = expr.add_left_join(rec_ps_subquery, "rec_ps.supporter_id=supporters.id")
.and_where('rec_ps.count > 0')
Expand Down

0 comments on commit 4390e30

Please sign in to comment.