diff --git a/src/registrar/management/commands/transfer_transition_domains_to_domains.py b/src/registrar/management/commands/transfer_transition_domains_to_domains.py index 58b36c1e5..c5b1c1ebd 100644 --- a/src/registrar/management/commands/transfer_transition_domains_to_domains.py +++ b/src/registrar/management/commands/transfer_transition_domains_to_domains.py @@ -2,7 +2,7 @@ import logging import argparse import sys -from django_fsm import TransitionNotAllowed # type: ignore +from django.forms import ValidationError from django.core.management import BaseCommand @@ -345,9 +345,6 @@ class Command(BaseCommand): return updated - def try_add_domain_information(self): - pass - def create_new_domain_info( self, transition_domain: TransitionDomain, @@ -382,11 +379,27 @@ class Command(BaseCommand): ) contact.save() elif contact_count == 1: - # TODO contact = contacts.get() + contact.first_name = first_name + contact.middle_name = middle_name + contact.last_name = last_name + contact.email = email + contact.phone = phone + contact.save() else: - logger.error("duplicates found") - + logger.warning(f"Duplicate contact found {contact}. Updating all relevant entries.") + for c in contact: + c.first_name = first_name + c.middle_name = middle_name + c.last_name = last_name + c.email = email + c.phone = phone + c.save() + contact = c.first() + + if debug_on: + logger.info(f"Contact created: {contact}") + org_type_current = transition_domain.organization_type match org_type_current: case "Federal": diff --git a/src/registrar/tests/data/test_authority_adhoc.txt b/src/registrar/tests/data/test_authority_adhoc.txt index 01e1a97db..3665182cd 100644 --- a/src/registrar/tests/data/test_authority_adhoc.txt +++ b/src/registrar/tests/data/test_authority_adhoc.txt @@ -2,5 +2,5 @@ authorityid|firstname|middlename|lastname|email|phonenumber|agencyid|addlinfo 1|Gregoor|middle|Kalinke|gkalinke0@indiegogo.com|(773) 172-5515|1|Asparagus - Mexican 2|Fayre||Filippozzi|ffilippozzi1@hugedomains.com|(357) 487-4280|2|Steampan - Foil 3|Gabey||Lightbody|glightbody2@fc2.com|(332) 816-5691|3|Soup - Campbells, Minestrone -4|Seline||Tower|stower3@answers.com|(151) 539-6028|4|Kiwi Gold Zespri -5|Joe||Smoe|joe@smoe.gov|(111) 111-1111|5|Kiwi Gold Zespri \ No newline at end of file +4|Seline|testmiddle2|Tower|stower3@answers.com|151-539-6028|4|Kiwi Gold Zespri +5|Joe|testmiddle|Smoe|joe@smoe.gov|(111) 111-1111|5|Kiwi Gold Zespri \ No newline at end of file diff --git a/src/registrar/tests/test_transition_domain_migrations.py b/src/registrar/tests/test_transition_domain_migrations.py index 5c93fd8f0..c6418f013 100644 --- a/src/registrar/tests/test_transition_domain_migrations.py +++ b/src/registrar/tests/test_transition_domain_migrations.py @@ -313,6 +313,14 @@ class TestMigrations(TestCase): self.assertEqual(fakewebsite.federal_agency, "Department of Commerce") self.assertEqual(fakewebsite.federal_type, "executive") + ao = fakewebsite.authorizing_official + + self.assertEqual(ao.first_name, "Seline") + self.assertEqual(ao.middle_name, "testmiddle2") + self.assertEqual(ao.last_name, "Tower") + self.assertEqual(ao.email, "stower3@answers.com") + self.assertEqual(ao.phone, "151-539-6028") + # Check for the "system" creator user Users = User.objects.filter(username="System") self.assertEqual(Users.count(), 1)