adds minimal public stats

This commit is contained in:
Juanjo Bazán
2016-02-08 14:12:37 +01:00
parent 885182aa93
commit 16db3f8537
5 changed files with 112 additions and 0 deletions

View File

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