Commit c98f2d16 authored by Ilya Zhitomirskiy's avatar Ilya Zhitomirskiy

added a weekly user stat for admin

parent 346e1f1c
......@@ -19,6 +19,18 @@ class AdminsController < ApplicationController
redirect_to user_search_path, :notice => flash[:notice]
end
def weekly_user_stats
@created_users_by_day = User.where("username IS NOT NULL").count(:group => "date(created_at)")
@created_users_by_week = {}
@created_users_by_day.keys.each do |k|
if @created_users_by_week[k.beginning_of_week].blank?
@created_users_by_week[k.beginning_of_week] = @created_users_by_day[k]
else
@created_users_by_week[k.beginning_of_week] += @created_users_by_day[k]
end
end
end
def stats
@popular_tags = ActsAsTaggableOn::Tagging.joins(:tag).limit(15).count(:group => :tag, :order => 'count(taggings.id) DESC')
......
......@@ -3,6 +3,7 @@
Pages
%ul
%li= link_to 'User Search', user_search_path
%li= link_to 'Weekly User Stats', weekly_user_stats_path
%li= link_to 'Pod Stats', pod_stats_path
.span-24
= render :partial => 'admins/admin_bar.haml'
%br
%br
.span-24.last
%h1
= "Users per week (Current server date is: #{Time.now.to_date}) "
%ul
- @created_users_by_week.keys.sort.each do |k|
%li
= "Week stating on #{k} , #{@created_users_by_week[k]}"
......@@ -93,6 +93,7 @@ Diaspora::Application.routes.draw do
scope 'admins', :controller => :admins do
match :user_search
get :admin_inviter
get :weekly_user_stats
get :stats, :as => 'pod_stats'
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment