add budget investment stats

This commit is contained in:
rgarcia
2017-03-13 20:43:24 +01:00
committed by Javi Martín
parent 135984d535
commit 11437a1d40
9 changed files with 163 additions and 1 deletions

View File

@@ -4,7 +4,8 @@ class Admin::Api::StatsController < Admin::Api::BaseController
unless params[:event].present? ||
params[:visits].present? ||
params[:spending_proposals].present? ||
params[:budget_investments].present?
params[:budget_investments].present? ||
params[:user_supported_budgets].present?
return render json: {}, status: :bad_request
end
@@ -26,6 +27,9 @@ class Admin::Api::StatsController < Admin::Api::BaseController
ds.add "Budget Investments", Budget::Investment.group_by_day(:created_at).count
end
if params[:user_supported_budgets].present?
ds.add "User supported budgets", Vote.where(votable_type: "Budget::Investment").group_by_day(:updated_at).count
end
render json: ds.build
end
end