Add semantic test fixes & maybe solution for an issue

This commit is contained in:
Alex Sherman 2021-01-22 16:07:26 +05:00
parent 541c2d769a
commit 21fc5edb44
2 changed files with 12 additions and 11 deletions

View file

@ -59,7 +59,7 @@ module Concerns::Domain::Transferable
copied_ids = []
domain_contacts.each do |dc|
contact = Contact.find(dc.contact_id)
next if copied_ids.include?(contact.id) || contact.registrar == new_registrar
next if copied_ids.include?(uniq_contact_hash(dc)) || contact.registrar == new_registrar
if registrant_id_was == contact.id # registrant was copied previously, do not copy it again
oc = OpenStruct.new(id: registrant_id)
@ -72,7 +72,11 @@ module Concerns::Domain::Transferable
else
dc.update(contact_id: oc.id)
end
copied_ids << contact.id
copied_ids << uniq_contact_hash(dc)
end
end
def uniq_contact_hash(contact)
Digest::SHA1.hexdigest(contact.contact_id.to_s + contact.type)
end
end