2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

FIX: use batches for speed, and show progress from importers' update_tl0

This commit is contained in:
Neil Lalonde 2015-03-20 17:05:13 -04:00
parent 3c4cee5f62
commit b1d78a4fd5

View file

@ -612,8 +612,15 @@ class ImportScripts::Base
end end
def update_tl0 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 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
end end