Parse AO information

This commit is contained in:
zandercymatics 2023-11-13 13:08:03 -07:00
parent 51b4c19e35
commit a4758f1b62
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
3 changed files with 30 additions and 9 deletions

View file

@ -2,7 +2,7 @@ import logging
import argparse import argparse
import sys import sys
from django_fsm import TransitionNotAllowed # type: ignore from django.forms import ValidationError
from django.core.management import BaseCommand from django.core.management import BaseCommand
@ -345,9 +345,6 @@ class Command(BaseCommand):
return updated return updated
def try_add_domain_information(self):
pass
def create_new_domain_info( def create_new_domain_info(
self, self,
transition_domain: TransitionDomain, transition_domain: TransitionDomain,
@ -382,10 +379,26 @@ class Command(BaseCommand):
) )
contact.save() contact.save()
elif contact_count == 1: elif contact_count == 1:
# TODO
contact = contacts.get() 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: 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 org_type_current = transition_domain.organization_type
match org_type_current: match org_type_current:

View file

@ -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 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 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 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 4|Seline|testmiddle2|Tower|stower3@answers.com|151-539-6028|4|Kiwi Gold Zespri
5|Joe||Smoe|joe@smoe.gov|(111) 111-1111|5|Kiwi Gold Zespri 5|Joe|testmiddle|Smoe|joe@smoe.gov|(111) 111-1111|5|Kiwi Gold Zespri

View file

@ -313,6 +313,14 @@ class TestMigrations(TestCase):
self.assertEqual(fakewebsite.federal_agency, "Department of Commerce") self.assertEqual(fakewebsite.federal_agency, "Department of Commerce")
self.assertEqual(fakewebsite.federal_type, "executive") 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 # Check for the "system" creator user
Users = User.objects.filter(username="System") Users = User.objects.filter(username="System")
self.assertEqual(Users.count(), 1) self.assertEqual(Users.count(), 1)