v0.59 Final topic-post import run -- add logic for appending counts since we are adding to a live Discourse host now

This commit is contained in:
David Sainty 2024-09-02 15:26:40 +10:00
parent 958e37771e
commit 7bd8f0068a
2 changed files with 4 additions and 4 deletions

Binary file not shown.

View File

@ -1564,7 +1564,7 @@ class GossamerForumsImporter < ImportScripts::Base
puts "OVERRIDE Highest processed post_id: #{highest_processed_post_id}"
# Execute the query to get all posts ordered by post_id
execute_query("SELECT post_id, user_id_fk, forum_id_fk, post_root_id, post_subject, post_time, post_message, post_father_id, post_likes, post_replies FROM gforum_Post WHERE post_id > #{highest_processed_post_id} ORDER BY post_id").each do |row|
execute_query("SELECT post_id, user_id_fk, forum_id_fk, post_root_id, post_subject, post_time, post_message, post_father_id, post_replies FROM gforum_Post WHERE post_id > #{highest_processed_post_id} ORDER BY post_id").each do |row|
post_id = row['post_id'].to_i
# Skip posts that have already been processed
@ -1673,15 +1673,15 @@ class GossamerForumsImporter < ImportScripts::Base
post = Post.create!(
topic_id: current_topic_id,
user_id: discourse_user_id,
# raw: import_attachments(row['post_message'], row['post_id']),
# raw: row['post_message'] || "",
raw: sanitized_post_message,
created_at: Time.at(row['post_time']),
updated_at: Time.at(row['post_time']),
like_count: row['post_likes'] || 0,
reads: post_views || 0,
post_number: post_number
)
# like_count: row['post_likes'] || 0,
# raw: import_attachments(row['post_message'], row['post_id']),
# raw: row['post_message'] || "",
# post_number: topic_post_numbers[topic.id]
post.custom_fields['original_gossamer_id'] = row['post_id']
post.save!