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:
evazion
2021-01-09 23:38:38 -06:00
parent e788d8d0b6
commit 5962152ee3
6 changed files with 98 additions and 36 deletions

View 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

View 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