Refactor UserSegment class
Simple refactor to avoid creating unnecessary variables and make it easier to read.
This commit is contained in:
@@ -11,30 +11,24 @@ class UserSegments
|
||||
end
|
||||
|
||||
def self.proposal_authors
|
||||
author_ids = Proposal.not_archived.not_retired.pluck(:author_id).uniq
|
||||
author_ids(author_ids)
|
||||
author_ids(Proposal.not_archived.not_retired.pluck(:author_id).uniq)
|
||||
end
|
||||
|
||||
def self.investment_authors
|
||||
author_ids = current_budget_investments.pluck(:author_id).uniq
|
||||
author_ids(author_ids)
|
||||
author_ids(current_budget_investments.pluck(:author_id).uniq)
|
||||
end
|
||||
|
||||
def self.feasible_and_undecided_investment_authors
|
||||
author_ids = current_budget_investments.where(feasibility: %w(feasible undecided))
|
||||
.pluck(:author_id).uniq
|
||||
|
||||
author_ids(author_ids)
|
||||
feasibility = %w(feasible undecided)
|
||||
author_ids(current_budget_investments.where(feasibility: feasibility).pluck(:author_id).uniq)
|
||||
end
|
||||
|
||||
def self.selected_investment_authors
|
||||
author_ids = current_budget_investments.selected.pluck(:author_id).uniq
|
||||
author_ids(author_ids)
|
||||
author_ids(current_budget_investments.selected.pluck(:author_id).uniq)
|
||||
end
|
||||
|
||||
def self.winner_investment_authors
|
||||
author_ids = current_budget_investments.winners.pluck(:author_id).uniq
|
||||
author_ids(author_ids)
|
||||
author_ids(current_budget_investments.winners.pluck(:author_id).uniq)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user