Merge pull request #4449 from pfaffman/importer-base-progress

importer/base.rb: improve progress reporting
This commit is contained in:
Régis Hanol 2016-09-22 11:01:48 +02:00 committed by GitHub
commit 30fbb91294
1 changed files with 8 additions and 2 deletions

View File

@ -583,15 +583,21 @@ class ImportScripts::Base
def update_user_stats def update_user_stats
puts "", "Updating topic reply counts..." puts "", "Updating topic reply counts..."
start_time = Time.now
progress_count = 0
total_count = User.real.count
User.find_each do |u| User.find_each do |u|
u.create_user_stat if u.user_stat.nil? u.create_user_stat if u.user_stat.nil?
us = u.user_stat us = u.user_stat
us.update_topic_reply_count us.update_topic_reply_count
us.save us.save
print "." progress_count += 1
print_status(progress_count, total_count, start_time)
end end
puts "Updating first_post_created_at..." puts "." "Updating first_post_created_at..."
sql = <<-SQL sql = <<-SQL
WITH sub AS ( WITH sub AS (