adds budget investments numbers and chart on admin stats

This commit is contained in:
Alberto Garcia Cabeza
2017-04-25 16:46:20 +02:00
parent 79f147ec00
commit 45af9ce5aa
7 changed files with 72 additions and 13 deletions

View File

@@ -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