diff --git a/app/controllers/admin/stats_controller.rb b/app/controllers/admin/stats_controller.rb index 6a2021592..9989da796 100644 --- a/app/controllers/admin/stats_controller.rb +++ b/app/controllers/admin/stats_controller.rb @@ -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_didnt_vote_proposals = @verified_users - @user_ids_who_voted_proposals @spending_proposals = SpendingProposal.count - @budgets = Budget.where.not(phase: 'finished').count - @investments = Budget.where.not(phase: 'finished').collect(&:investments).flatten.count + budgets_ids = Budget.where.not(phase: 'finished').pluck(:id) + @budgets = budgets_ids.size + @investments = Budget::Investment.where(budget_id: budgets_ids).count end def proposal_notifications