- puts "<h2>Top users editing over the past...</h2>"
- puts "<table>"
- puts "<tr><th>Day</th><th>Week</th><th>Month</th></tr>"
-
- day_users = OldNode.count(:conditions => "timestamp > NOW() - '1 DAY'::INTERVAL",
- :include => :changeset, :group => :user_id,
- :order => "count_all DESC")
- week_users = OldNode.count(:conditions => "timestamp > NOW() - '7 DAYS'::INTERVAL",
- :include => :changeset, :group => :user_id,
- :order => "count_all DESC", :limit => 60)
- month_users = OldNode.count(:conditions => "timestamp > NOW() - '28 DAYS'::INTERVAL",
- :include => :changeset, :group => :user_id,
- :order => "count_all DESC", :limit => 60)
-
- SyncEnumerator.new(day_users, week_users, month_users).each do |row|
- puts "<tr>"
- row.each do |column|
- if column.nil?
- puts "<td></td>"
- else
- display_name = User.find(column[0]).display_name.gsub('@', ' at ').gsub('.', ' dot ')
- count = column[1]
- puts "<td>#{count} <a href=\"/user/#{display_name}\">#{display_name}</a></td>"
+ puts "<h2>Top users editing over the past...</h2>"
+ puts "<table>"
+ puts "<tr><th>Day</th><th>Week</th><th>Month</th></tr>"
+
+ day_users = OldNode.count(:conditions => "timestamp > NOW() - '1 DAY'::INTERVAL",
+ :joins => :changeset, :group => :user_id,
+ :order => "count_all DESC")
+ week_users = OldNode.count(:conditions => "timestamp > NOW() - '7 DAYS'::INTERVAL",
+ :joins => :changeset, :group => :user_id,
+ :order => "count_all DESC", :limit => 60)
+ month_users = OldNode.count(:conditions => "timestamp > NOW() - '28 DAYS'::INTERVAL",
+ :joins => :changeset, :group => :user_id,
+ :order => "count_all DESC", :limit => 60)
+
+ SyncEnumerator.new(day_users, week_users, month_users).each do |row|
+ puts "<tr>"
+ row.each do |column|
+ if column.nil?
+ puts "<td></td>"
+ else
+ display_name = User.find(column[0]).display_name.gsub('@', ' at ').gsub('.', ' dot ')
+ count = column[1]
+ puts "<td>#{count} <a href=\"/user/#{display_name}\">#{display_name}</a></td>"
+ end