Skip to content
Extraits de code Groupes Projets
Valider c98f2d16 rédigé par Ilya Zhitomirskiy's avatar Ilya Zhitomirskiy
Parcourir les fichiers

added a weekly user stat for admin

parent 346e1f1c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -19,6 +19,18 @@ class AdminsController < ApplicationController ...@@ -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 @@ ...@@ -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
.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 ...@@ -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
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter