Skip to content

Commit

Permalink
Merge pull request #927 from CommitChange/add-supporter-cte
Browse files Browse the repository at this point in the history
Add supporters CTE to QuerySupporters
  • Loading branch information
wwahammy authored Sep 25, 2024
2 parents 1956a2d + b0c3cce commit a6ded77
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/legacy_lib/query_supporters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ def self._full_search(np_id, query)
# return new_supporters
# end

def self.supporters(np_id)
Qx.select('supporters.*')
.from(:supporters)
.where("supporters.nonprofit_id = $id and deleted != 'true'", id: np_id )
end

def self.undeleted_supporters(np_id)

Qx.select('id')
Expand Down Expand Up @@ -212,6 +218,7 @@ def self.full_filter_expr(np_id, query)
expr = Qx.select('supporters.id')
.with(:nonprofits, Qx.select("*").from(:nonprofits).where("id = $id", id: np_id.to_i))
.with(:tag_masters, Qx.select("*").from(:tag_masters).where("nonprofit_id = $id AND NOT deleted", id: np_id.to_i))
.with(:supporters, supporters(np_id))
.from(:supporters)
.join('nonprofits', 'nonprofits.id=supporters.nonprofit_id')
.where(
Expand Down

0 comments on commit a6ded77

Please sign in to comment.