Import scripts: add update_feature_topic_users
This commit is contained in:
parent
9bd76b0c16
commit
f085770ed4
|
@ -43,6 +43,9 @@ class ImportScripts::Base
|
||||||
execute
|
execute
|
||||||
|
|
||||||
update_bumped_at
|
update_bumped_at
|
||||||
|
update_feature_topic_users
|
||||||
|
|
||||||
|
puts '', 'Done'
|
||||||
|
|
||||||
ensure
|
ensure
|
||||||
RateLimiter.enable
|
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]})")
|
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
|
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)
|
def print_status(current, max)
|
||||||
print "\r%9d / %d (%5.1f%%) " % [current, max, ((current.to_f / max.to_f) * 100).round(1)]
|
print "\r%9d / %d (%5.1f%%) " % [current, max, ((current.to_f / max.to_f) * 100).round(1)]
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,8 +38,6 @@ class ImportScripts::Drupal < ImportScripts::Base
|
||||||
puts '', "Failed to create admin user"
|
puts '', "Failed to create admin user"
|
||||||
puts e.message
|
puts e.message
|
||||||
end
|
end
|
||||||
|
|
||||||
puts '', 'Done'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_blog_topics
|
def create_blog_topics
|
||||||
|
|
|
@ -63,8 +63,6 @@ class ImportScripts::Kunena < ImportScripts::Base
|
||||||
puts '', "Failed to create admin user"
|
puts '', "Failed to create admin user"
|
||||||
puts e.message
|
puts e.message
|
||||||
end
|
end
|
||||||
|
|
||||||
puts '', 'Done'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_files_exist
|
def check_files_exist
|
||||||
|
|
Loading…
Reference in New Issue