Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2023-10-05 main -> prod #2427

Merged
merged 8 commits into from
Oct 6, 2023
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
Loading