mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-17 19:12:37 -05:00
FEATURE: reset topic counters at the end of the import
This commit is contained in:
parent
1c5e8efa68
commit
a0569a22be
1 changed files with 14 additions and 0 deletions
|
@ -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"
|
||||
|
||||
|
|
Loading…
Reference in a new issue