Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
diaspora
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gigadoc 2
diaspora
Commits
c98f2d16
Commit
c98f2d16
authored
Sep 21, 2011
by
Ilya Zhitomirskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added a weekly user stat for admin
parent
346e1f1c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
0 deletions
+27
-0
app/controllers/admins_controller.rb
app/controllers/admins_controller.rb
+12
-0
app/views/admins/_admin_bar.haml
app/views/admins/_admin_bar.haml
+1
-0
app/views/admins/weekly_user_stats.haml
app/views/admins/weekly_user_stats.haml
+13
-0
config/routes.rb
config/routes.rb
+1
-0
No files found.
app/controllers/admins_controller.rb
View file @
c98f2d16
...
...
@@ -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'
)
...
...
app/views/admins/_admin_bar.haml
View file @
c98f2d16
...
...
@@ -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
app/views/admins/weekly_user_stats.haml
0 → 100644
View file @
c98f2d16
.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
]
}
"
config/routes.rb
View file @
c98f2d16
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment