To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / extra / soundsoftware / get-statistics.rb @ 1455:5e0957fe308d
History | View | Annotate | Download (664 Bytes)
| 1 |
|
|---|---|
| 2 |
# Log user and project information
|
| 3 |
#
|
| 4 |
# Invoke with e.g.
|
| 5 |
#
|
| 6 |
# ./script/rails runner -e production extra/soundsoftware/get-statistics.rb
|
| 7 |
#
|
| 8 |
|
| 9 |
projectStats = {
|
| 10 |
:all => Project.active.all.count, |
| 11 |
:private => Project.active.find(:all, :conditions => {:is_public => false}).count, |
| 12 |
:top_level => Project.active.find(:all, :conditions => {:parent_id => nil}).count, |
| 13 |
:top_level_and_private => Project.active.find(:all, :conditions => {:is_public => false, :parent_id => nil}).count |
| 14 |
} |
| 15 |
|
| 16 |
userStats = {:all => User.active.all.count}
|
| 17 |
|
| 18 |
stats = {:date => Date.today, :projects => projectStats, :users => userStats}.to_json
|
| 19 |
|
| 20 |
print "#{stats}\n"
|
| 21 |
|