fixed justask:recount

This commit is contained in:
nilsding 2014-11-29 12:21:42 +01:00
parent 178a01d2f1
commit 40f0e87fdc
1 changed files with 3 additions and 3 deletions

View File

@ -12,9 +12,9 @@ namespace :justask do
progress = ProgressBar.create title: 'Processing user', format: "%t (%c/%C) [%b>%i] %e", starting_at: 0, total: total progress = ProgressBar.create title: 'Processing user', format: "%t (%c/%C) [%b>%i] %e", starting_at: 0, total: total
User.all.each do |user| User.all.each do |user|
begin begin
answered = Question.where(user: user).count answered = Answer.where(user: user).count
asked = Question.where(user: user).where(author_is_anonymous: false).count asked = Question.where(user: user).where(author_is_anonymous: false).count
commented = Question.where(user: user).count commented = Comment.where(user: user).count
user.answered_count = answered user.answered_count = answered
user.asked_count = asked user.asked_count = asked
user.commented_count = commented user.commented_count = commented
@ -43,4 +43,4 @@ namespace :justask do
user.save! user.save!
puts "#{user.screen_name} no longer an admin" puts "#{user.screen_name} no longer an admin"
end end
end end