Mercurial > hg > soundsoftware-site
changeset 987:a5af76c3fca0 cannam
Merge from live branch
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Fri, 26 Oct 2012 17:19:19 +0100 |
parents | 5beffb0393f7 (current diff) 8b6acaabe2da (diff) |
children | 7c94a1b38c2f 6982f326cb06 f8a93c42287b |
files | |
diffstat | 1 files changed, 7 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/extra/soundsoftware/get-statistics.rb Fri Oct 26 17:19:01 2012 +0100 +++ b/extra/soundsoftware/get-statistics.rb Fri Oct 26 17:19:19 2012 +0100 @@ -25,8 +25,8 @@ def weeks_between(d1, d2) weeks = [] - start_date = Date.civil(d1.year, d1.month, 1) - end_date = Date.civil(d2.year, d2.month, 1) + start_date = Date.civil(d1.year, d1.month, d1.day) + end_date = Date.civil(d2.year, d2.month, d2.day) raise ArgumentError unless d1 <= d2 @@ -38,41 +38,22 @@ weeks << end_date end - -users = [] # dates = months_between(d1, d2) dates = weeks_between(d1, d2) -private_projects = [] -all_projects = [] -public_projects = [] -top_level_and_private_projects = [] - dates.each do |date| - users << User.find(:all, :conditions => {:created_on => d1..date}) - all_projects << Project.find(:all, :conditions => {:created_on => d1..date}) - private_projects << Project.find(:all, :conditions => {:created_on => d1..date, + users = User.find(:all, :conditions => {:created_on => d1..date}) + all_projects = Project.find(:all, :conditions => {:created_on => d1..date}) + private_projects = Project.find(:all, :conditions => {:created_on => d1..date, :is_public => false}) - top_level_and_private_projects << Project.find(:all, :conditions => {:created_on => d1..date, + top_level_and_private_projects = Project.find(:all, :conditions => {:created_on => d1..date, :is_public => false, :parent_id => nil}) - puts "#{date} #{users.size} #{all_projects.size} #{private_projects.size} \n" + puts "#{date} #{users.count} #{all_projects.count} #{private_projects.count} #{top_level_and_private_projects.count}\n" end - - - - -#nusers.each_with_index do |num, idx| -# puts "#{dates[idx]} #{num}\n" -#end - - - - -