removes unused code
This commit is contained in:
@@ -76,34 +76,6 @@ class Budget
|
||||
results.includes(:heading, :group, :budget, administrator: :user, valuators: :user)
|
||||
end
|
||||
|
||||
def self.limit_results(results, budget, max_per_heading, max_for_no_heading)
|
||||
return results if max_per_heading <= 0 && max_for_no_heading <= 0
|
||||
|
||||
ids = []
|
||||
if max_per_heading > 0
|
||||
budget.headings.pluck(:id).each do |hid|
|
||||
ids += Investment.where(heading_id: hid).order(confidence_score: :desc).limit(max_per_heading).pluck(:id)
|
||||
end
|
||||
end
|
||||
|
||||
if max_for_no_heading > 0
|
||||
ids += Investment.no_heading.order(confidence_score: :desc).limit(max_for_no_heading).pluck(:id)
|
||||
end
|
||||
|
||||
conditions = ["investments.id IN (?)"]
|
||||
values = [ids]
|
||||
|
||||
if max_per_heading == 0
|
||||
conditions << "investments.heading_id IS NOT ?"
|
||||
values << nil
|
||||
elsif max_for_no_heading == 0
|
||||
conditions << "investments.heading_id IS ?"
|
||||
values << nil
|
||||
end
|
||||
|
||||
results.where(conditions.join(' OR '), *values)
|
||||
end
|
||||
|
||||
def searchable_values
|
||||
{ title => 'A',
|
||||
author.username => 'B',
|
||||
|
||||
Reference in New Issue
Block a user