From ae2f8611014b334c8fc5519508f49af222c024a4 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 12 Feb 2015 12:24:53 -0500 Subject: [PATCH] FEATURE: import scripts update last_seen_at on users based on created date and last post date --- script/import_scripts/base.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/script/import_scripts/base.rb b/script/import_scripts/base.rb index 6334fbfeb..4895661f6 100644 --- a/script/import_scripts/base.rb +++ b/script/import_scripts/base.rb @@ -80,6 +80,7 @@ class ImportScripts::Base update_bumped_at update_last_posted_at + update_last_seen_at update_feature_topic_users update_category_featured_topics update_topic_count_replies @@ -508,6 +509,14 @@ class ImportScripts::Base User.exec_sql(sql) end + # scripts that are able to import last_seen_at from the source data should override this method + def update_last_seen_at + puts "", "updating last seen at on users" + + User.exec_sql("UPDATE users SET last_seen_at = created_at WHERE last_seen_at IS NULL") + User.exec_sql("UPDATE users SET last_seen_at = last_posted_at WHERE last_posted_at IS NOT NULL") + end + def update_feature_topic_users puts "", "updating featured topic users"