importer/base.rb: improve progress reporting

This commit is contained in:
Jay Pfaffman 2016-09-20 11:27:45 -07:00
parent 4f13422c47
commit 30f2081c1b
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 (