From 08346974cf03c11b85be0edae611e805f8adcd1c Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Wed, 4 Jun 2014 18:21:45 -0400 Subject: [PATCH] Import scripts: don't include moderator_action posts when calculating bumped_at --- script/import_scripts/base.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/import_scripts/base.rb b/script/import_scripts/base.rb index 2db79eeee..0996c3523 100644 --- a/script/import_scripts/base.rb +++ b/script/import_scripts/base.rb @@ -235,10 +235,6 @@ class ImportScripts::Base PostCreator.create(user, opts) end - def update_bumped_at - Post.exec_sql("update topics t set bumped_at = (select max(created_at) from posts where topic_id = t.id)") - end - def close_inactive_topics(opts={}) num_days = opts[:days] || 30 puts '', "Closing topics that have been inactive for more than #{num_days} days." @@ -254,6 +250,10 @@ class ImportScripts::Base end end + def update_bumped_at + 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 print_status(current, max) print "\r%9d / %d (%5.1f%%) " % [current, max, ((current.to_f / max.to_f) * 100).round(1)] end