v0.25.4 Bugfixing...
This commit is contained in:
parent
d5fdf78d62
commit
cb5159d5fe
@ -1,5 +1,5 @@
|
|||||||
# gossamer threads migration-import code
|
# gossamer threads migration-import code
|
||||||
# v0.25.2
|
# v0.25.4
|
||||||
|
|
||||||
require 'mysql2'
|
require 'mysql2'
|
||||||
require 'open-uri'
|
require 'open-uri'
|
||||||
@ -309,13 +309,18 @@ class GossamerForumsImporter < ImportScripts::Base
|
|||||||
def generate_unique_title(base_title, user_id, timestamp)
|
def generate_unique_title(base_title, user_id, timestamp)
|
||||||
unique_title = base_title
|
unique_title = base_title
|
||||||
suffix = 1
|
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})"
|
unique_title = "#{base_title} (#{suffix})"
|
||||||
puts "NEW unique_title #{unique_title}"
|
puts "NEW unique_title #{unique_title}"
|
||||||
suffix += 1
|
suffix += 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
puts "Final unique title: #{unique_title}"
|
||||||
unique_title
|
unique_title
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user