Skip to content

Commit

Permalink
Merge branch 'main' into tadhg/uei-ignore-status-handle-multiple
Browse files Browse the repository at this point in the history
  • Loading branch information
tadhg-ohiggins committed Oct 5, 2023
2 parents 1172c79 + cf254bd commit 9a28b4e
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/audit/intake_to_dissemination.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def load_finding_texts(self):
finding_text_ = FindingText(
report_id=self.report_id,
finding_ref_number=entry["reference_number"],
contains_chart_or_table=entry["contains_chart_or_table"] == "Y",
contains_chart_or_table=entry["contains_chart_or_table"],
finding_text=entry["text_of_finding"],
)
findings_text_objects.append(finding_text_)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import logging
from django.core.management.base import BaseCommand
from dissemination.models import (
AdditionalEin,
AdditionalUei,
CapText,
FederalAward,
Finding,
FindingText,
General,
Note,
Passthrough,
SecondaryAuditor,
)
from audit.models import SingleAuditChecklist

logger = logging.getLogger(__name__)


class Command(BaseCommand):
help = """
Deletes everything in `dissemination` tables and
regenerates them from data in the intake tables.
"""

dissemination_models = [
AdditionalEin,
AdditionalUei,
CapText,
FederalAward,
Finding,
FindingText,
General,
Note,
Passthrough,
SecondaryAuditor,
]

def delete_everything_in_dissemination_model(self, model):
model.objects.all().delete()

def handle(self, *args, **kwargs):
logger.info("Re-running dissemination for all records.")

# Begin by deleting all of the dissemination table contents.
for model in Command.dissemination_models:
logger.info(f"Deleting {model.__name__}")
self.delete_everything_in_dissemination_model(model)

# Now, re-run dissemination for everything
# in the intake tables.
for sac in SingleAuditChecklist.objects.all():
if sac.submission_status == SingleAuditChecklist.STATUS.DISSEMINATED:
logger.info(f"Disseminating {sac.report_id}")
sac.disseminate()
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 4.2.5 on 2023-10-05 22:49

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("dissemination", "0003_alter_general_fac_accepted_date"),
]

operations = [
migrations.AlterField(
model_name="findingtext",
name="contains_chart_or_table",
field=models.TextField(
help_text="Census mapping: FINDINGSTEXT, CHARTSTABLES",
verbose_name="Indicates whether or not the text contained charts or tables that could not be entered due to formatting restrictions",
),
),
]
2 changes: 1 addition & 1 deletion backend/dissemination/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FindingText(models.Model):
"Finding Reference Number - FK",
help_text=docs.finding_ref_nums_findingstext,
)
contains_chart_or_table = models.BooleanField(
contains_chart_or_table = models.TextField(
"Indicates whether or not the text contained charts or tables that could not be entered due to formatting restrictions",
help_text=docs.charts_tables_findingstext,
)
Expand Down

0 comments on commit 9a28b4e

Please sign in to comment.