improves query on admin stats controller
This commit is contained in:
@@ -21,8 +21,9 @@ class Admin::StatsController < Admin::BaseController
|
|||||||
@user_ids_who_voted_proposals = ActsAsVotable::Vote.where(votable_type: 'Proposal').distinct.count(:voter_id)
|
@user_ids_who_voted_proposals = ActsAsVotable::Vote.where(votable_type: 'Proposal').distinct.count(:voter_id)
|
||||||
@user_ids_who_didnt_vote_proposals = @verified_users - @user_ids_who_voted_proposals
|
@user_ids_who_didnt_vote_proposals = @verified_users - @user_ids_who_voted_proposals
|
||||||
@spending_proposals = SpendingProposal.count
|
@spending_proposals = SpendingProposal.count
|
||||||
@budgets = Budget.where.not(phase: 'finished').count
|
budgets_ids = Budget.where.not(phase: 'finished').pluck(:id)
|
||||||
@investments = Budget.where.not(phase: 'finished').collect(&:investments).flatten.count
|
@budgets = budgets_ids.size
|
||||||
|
@investments = Budget::Investment.where(budget_id: budgets_ids).count
|
||||||
end
|
end
|
||||||
|
|
||||||
def proposal_notifications
|
def proposal_notifications
|
||||||
|
|||||||
Reference in New Issue
Block a user