wiki pages, artists: fix normalization of other names.
Fix wiki pages and artists to normalize other names more consistently and correctly. For wiki pages, we strip leading / trailing / repeated underscores to fix user typos, and we normalize to NFKC form to make search more consistent. For artists, we allow leading / trailing / repeated underscores because some artist names have these, and we normalize to NFC form because some artists have weird names that would be lost by NFKC form. This does make search less consistent.
This commit is contained in:
17
script/fixes/071_renormalize_other_names_in_wiki_pages.rb
Executable file
17
script/fixes/071_renormalize_other_names_in_wiki_pages.rb
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require_relative "../../config/environment"
|
||||
|
||||
CurrentUser.scoped(User.system) do
|
||||
WikiPage.transaction do
|
||||
WikiPage.find_each do |wp|
|
||||
old_other_names = wp.other_names
|
||||
wp.other_names = old_other_names
|
||||
|
||||
if wp.changed?
|
||||
p [wp.id, wp.changes]
|
||||
wp.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
17
script/fixes/072_renormalize_other_names_in_artists.rb
Executable file
17
script/fixes/072_renormalize_other_names_in_artists.rb
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require_relative "../../config/environment"
|
||||
|
||||
CurrentUser.scoped(User.system) do
|
||||
Artist.transaction do
|
||||
Artist.find_each do |artist|
|
||||
old_other_names = artist.other_names
|
||||
artist.other_names = old_other_names
|
||||
|
||||
if artist.changed?
|
||||
p [artist.id, artist.changes]
|
||||
artist.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user