From 9964955e88efe58119f4b6b20ff7de1c97ca7773 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Mon, 8 Sep 2014 19:36:55 +0200 Subject: [PATCH] FEATURE: fix consistency of users.last_posted_at in importers --- script/import_scripts/base.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/script/import_scripts/base.rb b/script/import_scripts/base.rb index ec70799470b..e1a2697b654 100644 --- a/script/import_scripts/base.rb +++ b/script/import_scripts/base.rb @@ -73,6 +73,7 @@ class ImportScripts::Base puts "" update_bumped_at + update_last_posted_at update_feature_topic_users update_category_featured_topics update_topic_count_replies @@ -466,6 +467,11 @@ 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]})") end + def update_last_posted_at + puts "", "updaing last posted at on users" + User.exec_sql("UPDATE users SET last_posted_at = (SELECT MAX(posts.created_at) FROM posts WHERE posts.user_id = users.id)") + end + def update_feature_topic_users puts "", "updating featured topic users"