Skip to content

Commit

Permalink
Added logic to fix auditee name and title
Browse files Browse the repository at this point in the history
  • Loading branch information
sambodeme committed Oct 25, 2024
1 parent f50d9cc commit 44ae960
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import logging


from django.conf import settings

from census_historical_migration.transforms.xform_string_to_string import (
string_to_string,
)


logger = logging.getLogger(__name__)


def update_census_sac_auditee_name(sac, audit_header):
"""Fix the erroneous auditee_name and auditee_title in the auditee_certification of a SAC object."""
auditee_certification = sac.auditee_certification
auditee_signature = auditee_certification.get("auditee_signature", {})

# Get auditee name and title from audit_header or default to settings.GSA_MIGRATION
auditee_name = string_to_string(
getattr(audit_header, "AUDITEECERTIFYNAME", settings.GSA_MIGRATION)
)
auditee_title = string_to_string(
getattr(audit_header, "AUDITEECERTIFYTITLE", settings.GSA_MIGRATION)
)
# Update auditee_signature with new auditee_name and auditee_title
auditee_signature["auditee_name"] = auditee_name
auditee_signature["auditee_title"] = auditee_title
# Update auditee_signature in auditee_certification
auditee_certification["auditee_signature"] = auditee_signature

sac.auditee_certification = auditee_certification
sac.save()

0 comments on commit 44ae960

Please sign in to comment.