adds budget investments numbers and chart on admin stats
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
class Admin::Api::StatsController < Admin::Api::BaseController
|
||||
|
||||
def show
|
||||
unless params[:events].present? ||
|
||||
params[:visits].present? ||
|
||||
params[:spending_proposals].present?
|
||||
unless params[:events].present? ||
|
||||
params[:visits].present? ||
|
||||
params[:spending_proposals].present? ||
|
||||
params[:budget_investments].present?
|
||||
return render json: {}, status: :bad_request
|
||||
end
|
||||
|
||||
@@ -24,6 +25,10 @@ class Admin::Api::StatsController < Admin::Api::BaseController
|
||||
ds.add "Spending proposals", SpendingProposal.group_by_day(:created_at).count
|
||||
end
|
||||
|
||||
if params[:budget_investments].present?
|
||||
ds.add "Budget Investments", Budget::Investment.group_by_day(:created_at).count
|
||||
end
|
||||
|
||||
render json: ds.build
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,6 +21,8 @@ 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
|
||||
end
|
||||
|
||||
def proposal_notifications
|
||||
|
||||
Reference in New Issue
Block a user