FEATURE: reset topic counters at the end of the import

This commit is contained in:
Régis Hanol 2014-09-04 19:08:57 +02:00
parent 1c5e8efa68
commit a0569a22be
1 changed files with 14 additions and 0 deletions

View File

@ -76,6 +76,7 @@ class ImportScripts::Base
update_feature_topic_users
update_category_featured_topics
update_topic_count_replies
reset_topic_counters
puts "", "Done"
@ -478,6 +479,19 @@ class ImportScripts::Base
end
end
def reset_topic_counters
puts "", "reseting topic counters"
total_count = Topic.count
progress_count = 0
Topic.find_each do |topic|
Topic.reset_highest(topic.id)
progress_count += 1
print_status(progress_count, total_count)
end
end
def update_category_featured_topics
puts "", "updating featured topics in categories"