From bfbe1ebf8de7c794534132d9f02b13b831b4b812 Mon Sep 17 00:00:00 2001 From: James Person Date: Fri, 13 Oct 2023 07:41:11 -0400 Subject: [PATCH 1/5] Grab latest entry, not the first. (#2477) --- backend/audit/viewlib/upload_report_view.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/audit/viewlib/upload_report_view.py b/backend/audit/viewlib/upload_report_view.py index 020cdcc738..80760a3ba4 100644 --- a/backend/audit/viewlib/upload_report_view.py +++ b/backend/audit/viewlib/upload_report_view.py @@ -91,7 +91,9 @@ def get(self, request, *args, **kwargs): report_id = kwargs["report_id"] try: sac = SingleAuditChecklist.objects.get(report_id=report_id) - sar = SingleAuditReportFile.objects.filter(sac_id=sac.id).first() + sar = SingleAuditReportFile.objects.filter(sac_id=sac.id).latest( + "date_created" + ) current_info = { "cleaned_data": getattr(sar, "component_page_numbers", {}), From 9513f8e780a023a1473f51648fa931ebb7550f69 Mon Sep 17 00:00:00 2001 From: Tadhg O'Higgins <2626258+tadhg-ohiggins@users.noreply.github.com> Date: Fri, 13 Oct 2023 04:41:57 -0700 Subject: [PATCH 2/5] We don't use this method anywhere that I can find. (#2444) --- backend/audit/models.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/backend/audit/models.py b/backend/audit/models.py index 88019b1bac..849a4c8cc6 100644 --- a/backend/audit/models.py +++ b/backend/audit/models.py @@ -569,15 +569,6 @@ def get_transition_date(self, status): return self.transition_date[index] return None - def _general_info_get(self, key): - try: - return self.general_information[key] - except KeyError: - pass - except TypeError: - pass - return None - class AccessManager(models.Manager): """Custom manager for Access.""" From 79d4623102bb29c9eea074bcf209cab9ef7c5265 Mon Sep 17 00:00:00 2001 From: Matt Henry Date: Fri, 13 Oct 2023 10:45:26 -0400 Subject: [PATCH 3/5] Tweak client-side validation to allow audits from 2016 on (#2490) * Tweak client-side validation to allow audits from 2016 on * Tweak error message --------- Co-authored-by: Matt Henry --- backend/cypress/e2e/check-ueid.cy.js | 12 +++++++----- backend/static/js/check-ueid.js | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/backend/cypress/e2e/check-ueid.cy.js b/backend/cypress/e2e/check-ueid.cy.js index 7af4422b29..9102218634 100644 --- a/backend/cypress/e2e/check-ueid.cy.js +++ b/backend/cypress/e2e/check-ueid.cy.js @@ -92,13 +92,13 @@ describe('Create New Audit', () => { ); }); - it('should show an error if the user enters a date before 1/1/2020', () => { - cy.get('#auditee_fiscal_period_start').type('12/31/2019'); + it('should show an error if the user enters a date before 1/1/2016', () => { + cy.get('#auditee_fiscal_period_start').type('12/31/2015'); cy.get('#fy-error-message li').should('have.length', 1); }); - it('should not show an error if the user enters a date after 12/31/2019', () => { - cy.get('#auditee_fiscal_period_start').clear().type('12/31/2020'); + it('should not show an error if the user enters a date after 12/31/2015', () => { + cy.get('#auditee_fiscal_period_start').clear().type('1/1/2016'); cy.get('#fy-error-message li').should('have.length', 0); }); }); @@ -131,7 +131,9 @@ describe('Create New Audit', () => { it('should remove the error message when valid end date is supplied', () => { cy.get('#auditee_fiscal_period_end').type('01/31/2023').blur(); - cy.get('#auditee_fiscal_period_end-date-order').should('not.be.visible'); + cy.get('#auditee_fiscal_period_end-date-order').should( + 'not.be.visible' + ); }); }); diff --git a/backend/static/js/check-ueid.js b/backend/static/js/check-ueid.js index 3eb08d0dad..5030c55a00 100644 --- a/backend/static/js/check-ueid.js +++ b/backend/static/js/check-ueid.js @@ -193,10 +193,10 @@ function validateFyStartDate(fyInput) { [userFy.year, userFy.month, userFy.day] = fyInput.value.split('-'); fyErrorContainer.innerHTML = ''; - if (userFy.year < 2020) { + if (userFy.year < 2016) { const errorEl = document.createElement('li'); errorEl.innerHTML = - 'We are currently only accepting audits from FY22.\ + 'We are currently only accepting audits from FY16 or later.\ To submit an audit for a different fiscal period, \ visit the Census Bureau.'; fyErrorContainer.appendChild(errorEl); From c5daa192b5d675325a33524a767a06fb1c4f00a3 Mon Sep 17 00:00:00 2001 From: James Person Date: Fri, 13 Oct 2023 14:14:12 -0400 Subject: [PATCH 4/5] See if there are results before finding the latest. (#2495) --- backend/audit/viewlib/upload_report_view.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/audit/viewlib/upload_report_view.py b/backend/audit/viewlib/upload_report_view.py index 80760a3ba4..52540deaa1 100644 --- a/backend/audit/viewlib/upload_report_view.py +++ b/backend/audit/viewlib/upload_report_view.py @@ -91,9 +91,9 @@ def get(self, request, *args, **kwargs): report_id = kwargs["report_id"] try: sac = SingleAuditChecklist.objects.get(report_id=report_id) - sar = SingleAuditReportFile.objects.filter(sac_id=sac.id).latest( - "date_created" - ) + sar = SingleAuditReportFile.objects.filter(sac_id=sac.id) + if sar.exists(): + sar = sar.latest("date_created") current_info = { "cleaned_data": getattr(sar, "component_page_numbers", {}), From 52b303de18568b69610e832f8a3341342d85f759 Mon Sep 17 00:00:00 2001 From: Sudha Kumar <135276194+gsa-suk@users.noreply.github.com> Date: Fri, 13 Oct 2023 13:37:57 -0700 Subject: [PATCH 5/5] Sk/migrations fix (#2498) * Replacing auto_now_add with default, Census/GSA with CENSUS/GSAFAC * support model updates * Updated file per MJ * Recreate migrations * Migrations for model change * Using timezone.now * Formatted with black * Tested GSAFAC assignments * Updated default for CognizantBaseline * Updated migrations * Changes requested in PR review * CognizantBaeline help text migrations --- ...izantbaseline_cognizant_agency_and_more.py | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 backend/support/migrations/0005_alter_cognizantbaseline_cognizant_agency_and_more.py diff --git a/backend/support/migrations/0005_alter_cognizantbaseline_cognizant_agency_and_more.py b/backend/support/migrations/0005_alter_cognizantbaseline_cognizant_agency_and_more.py new file mode 100644 index 0000000000..4d02d3f6f1 --- /dev/null +++ b/backend/support/migrations/0005_alter_cognizantbaseline_cognizant_agency_and_more.py @@ -0,0 +1,81 @@ +# Generated by Django 4.2.5 on 2023-10-13 19:54 + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + dependencies = [ + ("support", "0004_alter_cognizantbaseline_date_assigned_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="cognizantbaseline", + name="cognizant_agency", + field=models.CharField( + help_text="Two digit Federal agency prefix of the cognizant agency", + max_length=2, + verbose_name="Cog Agency", + ), + ), + migrations.AlterField( + model_name="cognizantbaseline", + name="date_assigned", + field=models.DateTimeField( + default=django.utils.timezone.now, + help_text="Time when the cog agency was assigned to the entity", + null=True, + verbose_name="Date Assigned", + ), + ), + migrations.AlterField( + model_name="cognizantbaseline", + name="dbkey", + field=models.CharField( + help_text="Identifier for a submission along with audit_year in Census FAC", + max_length=20, + null=True, + verbose_name="dbkey", + ), + ), + migrations.AlterField( + model_name="cognizantbaseline", + name="ein", + field=models.CharField( + help_text="Primary Employer Identification Number", + max_length=30, + null=True, + verbose_name="EIN", + ), + ), + migrations.AlterField( + model_name="cognizantbaseline", + name="is_active", + field=models.BooleanField( + default=True, + help_text="Record to be ignored if this field is False", + verbose_name="Active", + ), + ), + migrations.AlterField( + model_name="cognizantbaseline", + name="source", + field=models.CharField( + default="GSAFAC", + help_text="Source of cognizant data", + max_length=10, + verbose_name="Source", + ), + ), + migrations.AlterField( + model_name="cognizantbaseline", + name="uei", + field=models.CharField( + help_text="Unique Employer Identification Number", + max_length=30, + null=True, + verbose_name="UEI", + ), + ), + ]