Merge pull request #1092 from consul/admin-summary-performance
improves performance of admin summary
This commit is contained in:
@@ -30,6 +30,7 @@ class SpendingProposal < ActiveRecord::Base
|
||||
scope :feasible, -> { where(feasible: true) }
|
||||
scope :unfeasible, -> { where(feasible: false) }
|
||||
scope :not_unfeasible, -> { where("feasible IS ? OR feasible = ?", nil, true) }
|
||||
scope :with_supports, -> { where('cached_votes_up > 0') }
|
||||
|
||||
scope :by_admin, -> (admin) { where(administrator_id: admin.presence) }
|
||||
scope :by_tag, -> (tag_name) { tagged_with(tag_name) }
|
||||
@@ -147,8 +148,4 @@ class SpendingProposal < ActiveRecord::Base
|
||||
valuation_finished.unfeasible
|
||||
end
|
||||
|
||||
def self.with_supports
|
||||
SpendingProposal.where(id: Vote.for_spending_proposals(SpendingProposal.all).map(&:votable).map(&:id))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user