From b1d78a4fd544fdde48928621c3cc818a8c5ec5a7 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Fri, 20 Mar 2015 17:05:13 -0400 Subject: [PATCH] FIX: use batches for speed, and show progress from importers' update_tl0 --- script/import_scripts/base.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/script/import_scripts/base.rb b/script/import_scripts/base.rb index 57df5214bcc..2e8c8d33365 100644 --- a/script/import_scripts/base.rb +++ b/script/import_scripts/base.rb @@ -612,8 +612,15 @@ class ImportScripts::Base end def update_tl0 - User.all.each do |user| + puts "", "setting users with no posts to trust level 0" + + total_count = User.count + progress_count = 0 + + User.find_each do |user| user.change_trust_level!(0) if Post.where(user_id: user.id).count == 0 + progress_count += 1 + print_status(progress_count, total_count) end end