Add compatible scope to Budget Investment and use it on the winners scope

Why:

* Only compatible investments can be winners

How:

* Using the new column incompatible to filter compatible investments
This commit is contained in:
Bertocq
2017-07-03 16:56:15 +02:00
parent 9c157e25bb
commit ed016d7afd

View File

@@ -50,7 +50,8 @@ class Budget
scope :undecided, -> { where(feasibility: "undecided") }
scope :with_supports, -> { where('cached_votes_up > 0') }
scope :selected, -> { feasible.where(selected: true) }
scope :winners, -> { selected.where(winner: true) }
scope :compatible, -> { where(incompatible: false) }
scope :winners, -> { selected.compatible.where(winner: true) }
scope :unselected, -> { not_unfeasible.where(selected: false) }
scope :last_week, -> { where("created_at >= ?", 7.days.ago)}