- 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|
+ day_users = OldNode.where("timestamp > NOW() - '1 DAY'::INTERVAL").joins(:changeset).order("count_all DESC").group(:user_id).count
+ week_users = OldNode.where("timestamp > NOW() - '7 DAYS'::INTERVAL").joins(:changeset).order("count_all DESC").limit(60).group(:user_id).count
+ month_users = OldNode.where("timestamp > NOW() - '28 DAYS'::INTERVAL").joins(:changeset).order("count_all DESC").limit(60).group(:user_id).count
+
+ day_users.zip(week_users, month_users).each do |row|