artists: filter out duplicates from other names (#4028).
This commit is contained in:
@@ -242,7 +242,8 @@ class Artist < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def normalize_other_names
|
def normalize_other_names
|
||||||
self.other_names = other_names.map { |x| Artist.normalize_name(x) }
|
self.other_names = other_names.map { |x| Artist.normalize_name(x) }.uniq
|
||||||
|
self.other_names -= [name]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -407,7 +407,7 @@ class ArtistTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
should "normalize its other names" do
|
should "normalize its other names" do
|
||||||
artist = FactoryBot.create(:artist, :name => "a1", :other_names => "aaa bbb ccc_ddd")
|
artist = FactoryBot.create(:artist, name: "a1", other_names: "a1 aaa aaa AAA bbb ccc_ddd")
|
||||||
assert_equal("aaa bbb ccc_ddd", artist.other_names_string)
|
assert_equal("aaa bbb ccc_ddd", artist.other_names_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user