Import scripts: add update_feature_topic_users

This commit is contained in:
Neil Lalonde 2014-06-05 15:30:29 -04:00
parent 9bd76b0c16
commit f085770ed4
3 changed files with 16 additions and 4 deletions

View File

@ -43,6 +43,9 @@ class ImportScripts::Base
execute
update_bumped_at
update_feature_topic_users
puts '', 'Done'
ensure
RateLimiter.enable
@ -261,6 +264,19 @@ class ImportScripts::Base
Post.exec_sql("update topics t set bumped_at = (select max(created_at) from posts where topic_id = t.id and post_type != #{Post.types[:moderator_action]})")
end
def update_feature_topic_users
puts '', "updating featured topic users"
total_count = Topic.count
progress_count = 0
Topic.find_each do |topic|
topic.feature_topic_users
progress_count += 1
print_status(progress_count, total_count)
end
end
def print_status(current, max)
print "\r%9d / %d (%5.1f%%) " % [current, max, ((current.to_f / max.to_f) * 100).round(1)]
end

View File

@ -38,8 +38,6 @@ class ImportScripts::Drupal < ImportScripts::Base
puts '', "Failed to create admin user"
puts e.message
end
puts '', 'Done'
end
def create_blog_topics

View File

@ -63,8 +63,6 @@ class ImportScripts::Kunena < ImportScripts::Base
puts '', "Failed to create admin user"
puts e.message
end
puts '', 'Done'
end
def check_files_exist