diff --git a/Changelog.md b/Changelog.md index 9b87b767492efe64bcf210e63ca9dbd667ce545c..306cad8036def8afac5b16c9c5319082626bf85d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,8 @@ # Changelog +## [0.12] - 2025-04-30 +- Changed NC-CC-DEP validation. The validator skips validation when all NC, CC and DEP are missing + ## [0.11] - 2025-04-29 - Changed NC-CC-DEP validation. The validator raises error when all NC, CC and DEP are missing diff --git a/sage_validation/file_validator/forms.py b/sage_validation/file_validator/forms.py index 5a1034ffd46797ba97f7a40c931d7da2693d4d8b..71d908ee494429edfa96a2cb8afe8d4a4f9770d1 100644 --- a/sage_validation/file_validator/forms.py +++ b/sage_validation/file_validator/forms.py @@ -245,10 +245,10 @@ class CSVUploadForm(forms.Form): nominal_account_name = row.get(nominal_account_field) if not cc and not dep and not nominal_account_name: - errors.append( - f"Row {index}: Missing values in '{cc_field}', '{dep_field}', and '{nominal_account_field}'.") continue if not cc or not dep or not nominal_account_name: + errors.append( + f"Row {index}: Missing values in '{cc_field}', '{dep_field}', or '{nominal_account_field}'.") continue cc_type = cost_centre_map.get(cc) diff --git a/setup.py b/setup.py index d4a53916ce318a47534c27fddecd4a72e44ae6a8..f2d5291e78b6b9a0a73bcf3174b2bbfa64d19b46 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import find_packages, setup setup( name="sage-validation", - version="0.11", + version="0.12", packages=find_packages(), include_package_data=True, install_requires=[ diff --git a/test/test_file_validator/test_forms.py b/test/test_file_validator/test_forms.py index 3a779cdac6eb0a0332b0451f61ccaf47fb2f90c7..e1f51defcb65ca7bbd7d1878d01f680a9e88f7f3 100644 --- a/test/test_file_validator/test_forms.py +++ b/test/test_file_validator/test_forms.py @@ -102,14 +102,13 @@ def test_validate_nc_cc_dep_combination_against_meo_sage_account_blank_values( { "NominalAnalysisNominalCostCentre/1": "", "NominalAnalysisNominalDepartment/1": "", - "NominalAnalysisNominalAccountNumber/1": "" }) form = CSVUploadForm(files={"file": modified_file}) assert not form.is_valid() assert ( "Row 1: Missing values in 'NominalAnalysisNominalCostCentre/1', 'NominalAnalysisNominalDepartment/1'," - " and 'NominalAnalysisNominalAccountNumber/1'." + " or 'NominalAnalysisNominalAccountNumber/1'." in str(form.errors["file"][0]) )