diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb new file mode 100644 index 000000000..4d7755994 --- /dev/null +++ b/app/controllers/stats_controller.rb @@ -0,0 +1,22 @@ +class StatsController < ApplicationController + include FeatureFlags + + feature_flag :public_stats + + skip_authorization_check + + def index + @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 + + @verified_users = User.with_hidden.level_two_or_three_verified.count + @unverified_users = User.with_hidden.unverified.count + end +end diff --git a/app/views/stats/index.html.erb b/app/views/stats/index.html.erb new file mode 100644 index 000000000..4065c3c40 --- /dev/null +++ b/app/views/stats/index.html.erb @@ -0,0 +1,64 @@ +
+ <%= t "stats.index.visits" %>
+ <%= number_with_delimiter(@visits) %>
+
+ <%= t "stats.index.debates" %>
+ <%= number_with_delimiter(@debates) %>
+
+ <%= t "stats.index.proposals" %>
+ <%= number_with_delimiter(@proposals) %>
+
+ <%= t "stats.index.comments" %>
+ <%= number_with_delimiter(@comments) %>
+
+ <%= t "stats.index.proposal_votes" %>
+ <%= number_with_delimiter(@proposal_votes) %>
+
+ <%= t "stats.index.debate_votes" %>
+ <%= number_with_delimiter(@debate_votes) %>
+
+ <%= t "stats.index.comment_votes" %>
+ <%= number_with_delimiter(@comment_votes) %>
+
+ <%= t "stats.index.votes" %>
+ <%= number_with_delimiter(@votes) %>
+
+ <%= t "stats.index.verified_users" %>
+ <%= number_with_delimiter(@verified_users) %>
+
+ <%= t "stats.index.unverified_users" %>
+ <%= number_with_delimiter(@unverified_users) %>
+