From a0569a22be09b5e6ccb5ef63b7b0c3ce17245c34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Thu, 4 Sep 2014 19:08:57 +0200 Subject: [PATCH] FEATURE: reset topic counters at the end of the import --- script/import_scripts/base.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/script/import_scripts/base.rb b/script/import_scripts/base.rb index 9eac081a9..273b0edc6 100644 --- a/script/import_scripts/base.rb +++ b/script/import_scripts/base.rb @@ -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"