FEATURE: import scripts update last_seen_at on users based on created date and last post date

This commit is contained in:
Neil Lalonde 2015-02-12 12:24:53 -05:00
parent 7b8c7ff3ef
commit ae2f861101
1 changed files with 9 additions and 0 deletions

View File

@ -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"