diff --git a/backend/data_fixtures/audit/excel_schema_test_files/federal-awards-audit-findings-pass-01.json b/backend/data_fixtures/audit/excel_schema_test_files/federal-awards-audit-findings-pass-01.json index db7207621f..05146cc0b0 100644 --- a/backend/data_fixtures/audit/excel_schema_test_files/federal-awards-audit-findings-pass-01.json +++ b/backend/data_fixtures/audit/excel_schema_test_files/federal-awards-audit-findings-pass-01.json @@ -40,6 +40,24 @@ "prior_references": "2022-033", "reference_number": "2023-001" } + }, + { + "program": { + "award_reference": "AWARD-0003", + "compliance_requirement": "BC" + }, + "questioned_costs": "Y", + "significant_deficiency": "N", + "other_matters": "Y", + "other_findings": "N", + "modified_opinion": "N", + "material_weakness": "Y", + "findings": { + "is_valid": "N", + "repeat_prior_reference": "N", + "prior_references": "N/A", + "reference_number": "2023-001" + } } ] } diff --git a/backend/data_fixtures/audit/test_data_entries/federal-awards-audit-findings-entries.json b/backend/data_fixtures/audit/test_data_entries/federal-awards-audit-findings-entries.json index 0c5e82b955..b4c87b82af 100644 --- a/backend/data_fixtures/audit/test_data_entries/federal-awards-audit-findings-entries.json +++ b/backend/data_fixtures/audit/test_data_entries/federal-awards-audit-findings-entries.json @@ -18,6 +18,7 @@ "compliance_requirement": "E", "reference_number": "2023-001", "repeat_prior_reference": "N", + "prior_references": "N/A", "is_valid": "Y", "questioned_costs": "N", "significant_deficiency": "N", diff --git a/backend/schemas/output/sections/FederalAwardsAuditFindings.schema.json b/backend/schemas/output/sections/FederalAwardsAuditFindings.schema.json index d1af51cf06..a0437b11ae 100644 --- a/backend/schemas/output/sections/FederalAwardsAuditFindings.schema.json +++ b/backend/schemas/output/sections/FederalAwardsAuditFindings.schema.json @@ -257,39 +257,67 @@ "properties": { "findings": { "additionalProperties": false, - "allOf": [ + "oneOf": [ { - "if": { - "properties": { - "repeat_prior_reference": { - "const": "Y", - "type": "string" + "allOf": [ + { + "if": { + "properties": { + "repeat_prior_reference": { + "const": "Y" + } + } + }, + "then": { + "properties": { + "prior_references": { + "description": "Prior references", + "pattern": "^20[1-9][0-9]-[0-9]{3}(,\\s*20[1-9][0-9]-[0-9]{3})*$", + "title": "PriorReferences", + "type": "string" + } + } + } + }, + { + "not": { + "properties": { + "repeat_prior_reference": { + "const": "N" + } + } } } - }, - "then": { - "required": [ - "prior_references" - ] - } + ] }, { - "if": { - "properties": { - "repeat_prior_reference": { - "const": "N", - "type": "string" + "allOf": [ + { + "if": { + "properties": { + "repeat_prior_reference": { + "const": "N" + } + } + }, + "then": { + "properties": { + "prior_references": { + "const": "N/A" + } + } } - } - }, - "then": { - "properties": { - "prior_references": { - "const": "N/A", - "type": "string" + }, + { + "not": { + "properties": { + "repeat_prior_reference": { + "const": "Y" + } + } } } - } + ] } ], "properties": { @@ -319,6 +347,7 @@ }, "required": [ "reference_number", + "prior_references", "repeat_prior_reference" ], "type": "object" diff --git a/backend/schemas/source/sections/FederalAwardsAuditFindings.schema.jsonnet b/backend/schemas/source/sections/FederalAwardsAuditFindings.schema.jsonnet index 2a2d8c0a7f..28d928e580 100644 --- a/backend/schemas/source/sections/FederalAwardsAuditFindings.schema.jsonnet +++ b/backend/schemas/source/sections/FederalAwardsAuditFindings.schema.jsonnet @@ -4,6 +4,7 @@ local Sheets = import '../excel/libs/Sheets.libsonnet'; local Additional = import 'FederalAwardsAuditFindings.validation.libsonnet'; local Types = Base.Types; local Validations = Additional.Validations; +local Func = import '../base/Functions.libsonnet'; local Meta = Types.object { additionalProperties: false, @@ -41,9 +42,10 @@ local Parts = { }, required: [ 'reference_number', + 'prior_references', 'repeat_prior_reference', ], - allOf: Validations.PriorReferences, + oneOf: Validations.PriorReferences, }, }; diff --git a/backend/schemas/source/sections/FederalAwardsAuditFindings.validation.libsonnet b/backend/schemas/source/sections/FederalAwardsAuditFindings.validation.libsonnet index 9dc75b28bc..e960babce5 100644 --- a/backend/schemas/source/sections/FederalAwardsAuditFindings.validation.libsonnet +++ b/backend/schemas/source/sections/FederalAwardsAuditFindings.validation.libsonnet @@ -230,34 +230,61 @@ local Validations = { ], PriorReferences: [ { - 'if': { - properties: { - repeat_prior_reference: Base.Types.string { - const: Base.Const.Y, - }, + allOf: [ + { + "if": { + properties: { + repeat_prior_reference: { + const: Base.Const.Y + } + } + }, + "then": { + properties: { + "prior_references": Base.Compound.PriorReferences + } + } }, - }, - 'then': { - required:['prior_references'] - }, + { + not: { + properties: { + repeat_prior_reference: { + const: Base.Const.N + } + } + } + } + ] }, { - 'if': { - properties: { - repeat_prior_reference: Base.Types.string { - const: Base.Const.N, - }, + allOf: [ + { + "if": { + properties: { + repeat_prior_reference: { + const: Base.Const.N + } + } + }, + "then": { + properties: { + prior_references: { + const: Base.Const.NA + } + } + } }, - }, - 'then': { - properties: { - // required:['prior_references'], - prior_references: Base.Types.string { - const: Base.Const.NA - }, - }, - }, - }, + { + not: { + properties: { + repeat_prior_reference: { + const: Base.Const.Y + } + } + } + } + ] + } ], };