From cb5159d5fe7f0757aa59977be3ea708cd6cee526 Mon Sep 17 00:00:00 2001 From: saint Date: Tue, 2 Jul 2024 14:34:24 +1000 Subject: [PATCH] v0.25.4 Bugfixing... --- gossamer_forums.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gossamer_forums.rb b/gossamer_forums.rb index 7682069..015c3eb 100644 --- a/gossamer_forums.rb +++ b/gossamer_forums.rb @@ -1,5 +1,5 @@ # gossamer threads migration-import code -# v0.25.2 +# v0.25.4 require 'mysql2' require 'open-uri' @@ -309,13 +309,18 @@ class GossamerForumsImporter < ImportScripts::Base def generate_unique_title(base_title, user_id, timestamp) unique_title = base_title suffix = 1 - - while Topic.exists?(title: unique_title) + + puts "Generating unique title for base title: #{base_title}" + + while Topic.where(title: unique_title).exists? +# while Topic.exists?(title: unique_title) + puts "Title '#{unique_title}' already exists, generating a new one." unique_title = "#{base_title} (#{suffix})" puts "NEW unique_title #{unique_title}" suffix += 1 end - + + puts "Final unique title: #{unique_title}" unique_title end