added a weekly user stat for admin
This commit is contained in:
parent
346e1f1c87
commit
c98f2d1664
4 changed files with 27 additions and 0 deletions
|
|
@ -19,6 +19,18 @@ class AdminsController < ApplicationController
|
||||||
redirect_to user_search_path, :notice => flash[:notice]
|
redirect_to user_search_path, :notice => flash[:notice]
|
||||||
end
|
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
|
def stats
|
||||||
@popular_tags = ActsAsTaggableOn::Tagging.joins(:tag).limit(15).count(:group => :tag, :order => 'count(taggings.id) DESC')
|
@popular_tags = ActsAsTaggableOn::Tagging.joins(:tag).limit(15).count(:group => :tag, :order => 'count(taggings.id) DESC')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
Pages
|
Pages
|
||||||
%ul
|
%ul
|
||||||
%li= link_to 'User Search', user_search_path
|
%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
|
%li= link_to 'Pod Stats', pod_stats_path
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
13
app/views/admins/weekly_user_stats.haml
Normal file
13
app/views/admins/weekly_user_stats.haml
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
.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
|
scope 'admins', :controller => :admins do
|
||||||
match :user_search
|
match :user_search
|
||||||
get :admin_inviter
|
get :admin_inviter
|
||||||
|
get :weekly_user_stats
|
||||||
get :stats, :as => 'pod_stats'
|
get :stats, :as => 'pod_stats'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue