Improvements in importing the lithium pms

This commit is contained in:
Vinoth Kannan 2018-05-18 22:57:15 +05:30
parent d57a17879a
commit ba0dd5889d

View File

@ -430,9 +430,7 @@ class ImportScripts::Lithium < ImportScripts::Base
new_post new_post
else else
message = "Unknown" PluginStoreRow.create(plugin_name: "post_import_log", key: post["unique_id"].to_s, value: "Post 'body' is empty")
message = "Post 'body' is empty" if raw.blank?
PluginStoreRow.create(plugin_name: "post_import_log", key: post["unique_id"].to_s, value: message)
nil nil
end end
end end
@ -467,7 +465,7 @@ class ImportScripts::Lithium < ImportScripts::Base
def import_likes def import_likes
puts "\nimporting likes..." puts "\nimporting likes..."
sql = "select source_id user_id, target_id post_id, row_version created_at from wd.tag_events_score_message" sql = "select source_id user_id, target_id post_id, row_version created_at from tag_events_score_message"
results = mysql_query(sql) results = mysql_query(sql)
puts "loading unique id map" puts "loading unique id map"
@ -697,6 +695,7 @@ class ImportScripts::Lithium < ImportScripts::Base
raw = topic["body"] raw = topic["body"]
if raw.present?
msg = { msg = {
id: "pm_#{topic["note_id"]}", id: "pm_#{topic["note_id"]}",
user_id: user_id, user_id: user_id,
@ -714,6 +713,10 @@ class ImportScripts::Lithium < ImportScripts::Base
end end
msg msg
else
PluginStoreRow.create(plugin_name: "pm_import_log", key: topic["note_id"].to_s, value: "PM 'body' is empty")
nil
end
end end
end end