diff --git a/app/controllers/admin/stats_controller.rb b/app/controllers/admin/stats_controller.rb index 3bcb50a86..ec5c2d19d 100644 --- a/app/controllers/admin/stats_controller.rb +++ b/app/controllers/admin/stats_controller.rb @@ -2,6 +2,22 @@ class Admin::StatsController < Admin::BaseController def show @event_types = Ahoy::Event.group(:name).count + + @visits = Visit.count + @debates = Debate.with_hidden.count + @proposals = Proposal.with_hidden.count + @comments = Comment.with_hidden.count + + @debate_votes = Vote.where(votable_type: 'Debate').count + @proposal_votes = Vote.where(votable_type: 'Proposal').count + @comment_votes = Vote.where(votable_type: 'Comment').count + @votes = Vote.count + + @user_level_two = User.with_hidden.level_two_verified.count + @user_level_three = User.with_hidden.level_three_verified.count + @verified_users = User.with_hidden.level_two_or_three_verified.count + @unverified_users = User.with_hidden.unverified.count + @users = User.with_hidden.count end end diff --git a/app/views/admin/stats/show.html.erb b/app/views/admin/stats/show.html.erb index 42c7e6726..1f6c39327 100644 --- a/app/views/admin/stats/show.html.erb +++ b/app/views/admin/stats/show.html.erb @@ -4,15 +4,32 @@
-

Stats

+

<%= t "admin.stats.show.stats_title" %>

+ +

<%= t "admin.stats.show.summary_title" %>

+
    +
  • <%= t "admin.stats.show.summary.visits" %>: <%= @visits %>
  • +
  • <%= t "admin.stats.show.summary.debates" %>: <%= @debates %>
  • +
  • <%= t "admin.stats.show.summary.proposals" %>: <%= @proposals %>
  • +
  • <%= t "admin.stats.show.summary.comments" %>: <%= @comments %>
  • +
  • <%= t "admin.stats.show.summary.debate_votes" %>: <%= @debate_votes %>
  • +
  • <%= t "admin.stats.show.summary.proposal_votes" %>: <%= @proposal_votes %>
  • +
  • <%= t "admin.stats.show.summary.comment_votes" %>: <%= @comment_votes %>
  • +
  • <%= t "admin.stats.show.summary.votes" %>: <%= @votes %>
  • +
  • <%= t "admin.stats.show.summary.user_level_two" %>: <%= @user_level_two %>
  • +
  • <%= t "admin.stats.show.summary.user_level_three" %>: <%= @user_level_three %>
  • +
  • <%= t "admin.stats.show.summary.verified_users" %>: <%= @verified_users %>
  • +
  • <%= t "admin.stats.show.summary.unverified_users" %>: <%= @unverified_users %>
  • +
  • <%= t "admin.stats.show.summary.users" %>: <%= @users %>
  • +
-

Visits

+

<%= t "admin.stats.show.combined_title" %>

<%= visits_chart_tag id: "visits" %>
-

Combined

+

<%= t "admin.stats.show.visits_title" %>

<%= events_chart_tag @event_types.keys, id: 'combined' %>