Add_stats_for_Investment_Proyect_#918
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
class Admin::Api::StatsController < Admin::Api::BaseController
|
||||
|
||||
def show
|
||||
unless params[:events].present? || params[:visits].present?
|
||||
unless params[:events].present? ||
|
||||
params[:visits].present? ||
|
||||
params[:spending_proposals].present?
|
||||
return render json: {}, status: :bad_request
|
||||
end
|
||||
|
||||
@@ -18,7 +20,10 @@ class Admin::Api::StatsController < Admin::Api::BaseController
|
||||
ds.add "Visits", Visit.group_by_day(:started_at).count
|
||||
end
|
||||
|
||||
if params[:spending_proposals].present?
|
||||
ds.add "Spending proposals", SpendingProposal.group_by_day(:created_at).count
|
||||
end
|
||||
|
||||
render json: ds.build
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -18,6 +18,6 @@ class Admin::StatsController < Admin::BaseController
|
||||
@verified_users = User.with_hidden.level_two_or_three_verified.count
|
||||
@unverified_users = User.with_hidden.unverified.count
|
||||
@users = User.with_hidden.count
|
||||
@spending_proposals = SpendingProposal.count
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user