Skip to content

Commit

Permalink
Removed comments, Fixed format
Browse files Browse the repository at this point in the history
  • Loading branch information
gsa-suk committed Dec 13, 2024
1 parent cdf4e34 commit bbe2f45
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 55 deletions.
6 changes: 3 additions & 3 deletions backend/support/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ def change_view(self, request, object_id, form_url="", extra_context=None):
extra_context = extra_context or {}
extra_context["show_save_and_continue"] = False
extra_context["show_save"] = False
extra_context["show_save_and_add_another"] = (
False # this does not work if has_add_permision is True
)
extra_context[
"show_save_and_add_another"
] = False # this does not work if has_add_permision is True
return super().change_view(request, object_id, extra_context=extra_context)

def save_model(self, request, obj, form, change):
Expand Down
18 changes: 1 addition & 17 deletions backend/support/cog_over.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def compute_cog_over(
oversight_agency = agency
# logger.warning("Assigning an oversight agenct", oversight_agency)
return (cognizant_agency, oversight_agency)
# base_year = calc_base_year(audit_year)

cognizant_agency = determine_hist_agency(auditee_ein, auditee_uei, audit_year)
if cognizant_agency:
return (cognizant_agency, oversight_agency)
Expand Down Expand Up @@ -106,7 +106,6 @@ def determine_hist_agency(ein, uei, audit_year):
if int(base_year) == FIRST_BASELINE_YEAR:
dbkey = get_dbkey(ein, uei)

# cog_agency = lookup_baseline(ein, uei, dbkey)
cog_agency = lookup_latest_cog(ein, uei, dbkey, base_year, audit_year)
if cog_agency:
return cog_agency
Expand Down Expand Up @@ -152,21 +151,6 @@ def get_dbkey(ein, uei):
return dbkey


# def lookup_baseline(ein, uei, dbkey):
# try:
# cognizant_agency = CognizantBaseline.objects.values_list(
# "cognizant_agency", flat=True
# ).get(
# Q(is_active=True)
# & ((Q(ein=ein) & Q(dbkey=dbkey)) | (Q(ein=ein) & Q(uei=uei)))
# )[
# :
# ]
# except (CognizantBaseline.DoesNotExist, CognizantBaseline.MultipleObjectsReturned):
# cognizant_agency = None
# return cognizant_agency


def lookup_latest_cog(ein, uei, dbkey, base_year, audit_year):
query_years = [str(year) for year in range(int(base_year), int(audit_year) + 1)]
cognizant_agency = None
Expand Down
1 change: 0 additions & 1 deletion backend/support/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
CognizantAssignment,
)
from .cog_over import AssignmentTypeCode
# from .cog_over import reset_baseline

models = [AdminApiEvent, CognizantAssignment]
_for_the_linter = [AssignmentTypeCode]
4 changes: 0 additions & 4 deletions backend/support/models/cog_over.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from django.apps import apps
from django.db import models
from django.db.models import Q
from django.utils import timezone


class AssignmentTypeCode:
Expand Down Expand Up @@ -50,8 +48,6 @@ def save(self, *args, **kwargs):
sac.cognizant_agency = cognizant_agency
sac.save()

uei, ein = sac.auditee_uei, sac.ein

try:
gen_model = apps.get_model("dissemination.General")
gen = gen_model.objects.get(report_id=sac.report_id)
Expand Down
32 changes: 2 additions & 30 deletions backend/support/test_cog_over.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,14 +419,6 @@ def test_cog_assignment_with_uei_in_baseline(self):
)
migration_inspection_record.save()

# baker.make(
# CognizantBaseline,
# uei=BASE_UEI,
# ein=BASE_EIN,
# dbkey=RESOLVABLE_DBKEY_WITH_BASELINE,
# cognizant_agency=BASE_COG,
# is_active=True,
# )
cog_agency, over_agency = compute_cog_over(
sac.federal_awards,
sac.submission_status,
Expand All @@ -449,15 +441,6 @@ def test_cog_assignment_with_uei_in_baseline_and_overris(self):
sac.report_id = "9991-09-GSAFAC-0000201851"
sac.save()

# baker.make(
# CognizantBaseline,
# uei=BASE_UEI,
# ein=BASE_EIN,
# cognizant_agency=BASE_COG,
# )
# cbs = CognizantBaseline.objects.all()
# self.assertEqual(len(cbs), 1)

cog_agency, _ = compute_cog_over(
sac.federal_awards,
sac.submission_status,
Expand All @@ -468,8 +451,7 @@ def test_cog_assignment_with_uei_in_baseline_and_overris(self):
record_cog_assignment(sac.report_id, sac.submitted_by, cog_agency)
cas = CognizantAssignment.objects.all()
self.assertEqual(len(cas), 1)
# cbs = CognizantBaseline.objects.all()
# self.assertEqual(len(cbs), 1)

sac = SingleAuditChecklist.objects.get(report_id=sac.report_id)
self.assertEqual(sac.cognizant_agency, cog_agency)

Expand All @@ -482,8 +464,7 @@ def test_cog_assignment_with_uei_in_baseline_and_overris(self):
).save()
cas = CognizantAssignment.objects.all()
self.assertEqual(len(cas), 2)
# cbs = CognizantBaseline.objects.all()
# self.assertEqual(len(cbs), 2)

sac = SingleAuditChecklist.objects.get(report_id=sac.report_id)
self.assertEqual(sac.cognizant_agency, oberride_cog)

Expand Down Expand Up @@ -578,15 +559,6 @@ def test_cog_assignment_for_2027_w_baseline(self):

sac.save()

# baker.make(
# CognizantBaseline,
# uei="ZQGGHJH74DW7",
# ein=UNIQUE_EIN_WITHOUT_DBKEY,
# cognizant_agency="24",
# )
# cbs = CognizantBaseline.objects.all()
# self.assertEqual(len(cbs), 1)

cog_agency, over_agency = compute_cog_over(
sac.federal_awards,
sac.submission_status,
Expand Down

0 comments on commit bbe2f45

Please sign in to comment.