Skip to content

Commit

Permalink
added filter functionality for showing all applications (i.e 90 days …
Browse files Browse the repository at this point in the history
…or older)
  • Loading branch information
nickdip committed Mar 20, 2024
1 parent 4e608cf commit 2ae3222
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions app/lib/filters/show_all_applications.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
module Filters
class ShowAllApplications < Base
def apply
Rails.logger.debug "DEBUG showallapplications #{params.inspect}"
if show_all_applications.empty?
ninety_days_ago = 90.days.ago
new_scope =
scope.where(
"awarded_at >= :ninety_days OR declined_at >= :ninety_days OR withdrawn_at >= :ninety_days",
ninety_days: ninety_days_ago,
)
return new_scope
end

if show_all_applications.empty?
ninety_days_ago = 90.days.ago
new_scope = scope.where("awarded_at >= :ninety_days OR declined_at >= :ninety_days OR withdrawn_at >= :ninety_days", ninety_days: ninety_days_ago)
return new_scope
end

return scope
scope
end

private

def show_all_applications
Array(params[:display]).compact_blank
Array(params[:display]).compact_blank
end
end
end

0 comments on commit 2ae3222

Please sign in to comment.