Hook up investigator

This commit is contained in:
zandercymatics 2024-06-05 15:28:01 -06:00
parent f9cec62a03
commit 9898fe16c0
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
2 changed files with 19 additions and 6 deletions

View file

@ -43,6 +43,11 @@ class DomainRequest(TimeStampedModel):
REJECTED = "rejected", "Rejected" REJECTED = "rejected", "Rejected"
INELIGIBLE = "ineligible", "Ineligible" INELIGIBLE = "ineligible", "Ineligible"
@classmethod
def get_status_label(cls, status_name: str):
"""Returns the associated label for a given status name"""
return cls(status_name).label if status_name else None
class StateTerritoryChoices(models.TextChoices): class StateTerritoryChoices(models.TextChoices):
ALABAMA = "AL", "Alabama (AL)" ALABAMA = "AL", "Alabama (AL)"
ALASKA = "AK", "Alaska (AK)" ALASKA = "AK", "Alaska (AK)"

View file

@ -770,7 +770,7 @@ class DomainRequestExport:
"Other contacts": request.get('all_other_contacts'), "Other contacts": request.get('all_other_contacts'),
"CISA regional representative": request.get('cisa_representative_email'), # TODO - same problem as before "CISA regional representative": request.get('cisa_representative_email'), # TODO - same problem as before
"Current websites": request.get('all_current_websites'), "Current websites": request.get('all_current_websites'),
"Investigator": request.get('investigator'), "Investigator": request.get('investigator_email'),
} }
row = [FIELDS.get(column, "") for column in columns] row = [FIELDS.get(column, "") for column in columns]
@ -936,6 +936,7 @@ class DomainRequestExport:
distinct=True distinct=True
), ),
federal_agency_name = F("federal_agency__agency"), federal_agency_name = F("federal_agency__agency"),
investigator_email = F("investigator__email"),
human_readable_election_board=Case( human_readable_election_board=Case(
When(is_election_board=True, then=Value("Yes")), When(is_election_board=True, then=Value("Yes")),
When(is_election_board=False, then=Value("No")), When(is_election_board=False, then=Value("No")),
@ -964,6 +965,8 @@ class DomainRequestExport:
'authorizing_official__last_name', 'authorizing_official__last_name',
'authorizing_official__email', 'authorizing_official__email',
'authorizing_official__title', 'authorizing_official__title',
# Investigator
"investigator_email",
# Existing fields # Existing fields
"id", "id",
'submission_date', 'submission_date',
@ -981,19 +984,21 @@ class DomainRequestExport:
) )
for request in requests_dict: for request in requests_dict:
# Handle the domain_type field # Handle the domain_type field. Defaults to the wrong format.
org_type = request.get("generic_org_type") org_type = request.get("generic_org_type")
request["domain_type"] = None
if org_type: if org_type:
readable_org_type = DomainRequest.OrganizationChoices.get_org_label(org_type) readable_org_type = DomainRequest.OrganizationChoices.get_org_label(org_type)
request["domain_type"] = readable_org_type request["domain_type"] = readable_org_type
# Handle the federal_type field. Defaults to the wrong variant. # Handle the federal_type field. Defaults to the wrong format.
federal_type = request.get("federal_type") federal_type = request.get("federal_type")
if federal_type: if federal_type:
request["human_readable_federal_type"] = DomainRequest.BranchChoices.get_branch_label(federal_type) request["human_readable_federal_type"] = DomainRequest.BranchChoices.get_branch_label(federal_type)
else:
request["human_readable_federal_type"] = None # Handle the status field. Defaults to the wrong format.
status = request.get("status")
if status:
request["status_display"] = DomainRequest.DomainRequestStatus.get_status_label(status)
return requests_dict return requests_dict
@ -1035,6 +1040,9 @@ class DomainRequestExport:
`f"{cisa_rep} | {anything_else}" If anything_else or cisa_rep else None` `f"{cisa_rep} | {anything_else}" If anything_else or cisa_rep else None`
""" """
# TODO this should be replaced with cisa_representative_first_name and cisa_representative_last_name
# When that PR gets merged
additional_details_query = Case( additional_details_query = Case(
# Check if either cisa_representative_email or anything_else is not null # Check if either cisa_representative_email or anything_else is not null
# TODO - touch up on this # TODO - touch up on this