diff --git a/bc_obps/reporting/service/report_verification_service.py b/bc_obps/reporting/service/report_verification_service.py index de20695297..69fec78938 100644 --- a/bc_obps/reporting/service/report_verification_service.py +++ b/bc_obps/reporting/service/report_verification_service.py @@ -71,13 +71,14 @@ def get_report_needs_verification(version_id: int) -> bool: Operation.Purposes.NEW_ENTRANT_OPERATION, } ATTRIBUTABLE_EMISSION_THRESHOLD = Decimal("25000000") - registration_purpose = ReportAdditionalDataService.get_registration_purpose_by_version_id(version_id) - # Registration Purpose: verification data is required if the registration purpose is in REGULATED_OPERATION_PURPOSES - registration_purpose_value = registration_purpose.get("registration_purpose", {}) + # Fetch registration purpose + registration_purpose = ReportAdditionalDataService.get_registration_purpose_by_version_id(version_id) - if registration_purpose in REGULATED_OPERATION_PURPOSES: - return True + # Compare the enum value + if isinstance(registration_purpose, Operation.Purposes): + if registration_purpose in REGULATED_OPERATION_PURPOSES: + return True # Emission threshold: verification data is required if the registration purpose is Reporting Operation, and total TCo₂e >= 25,000 if registration_purpose == Operation.Purposes.REPORTING_OPERATION: diff --git a/bc_obps/reporting/tests/service/test_report_verification_service.py b/bc_obps/reporting/tests/service/test_report_verification_service.py index d5690ef678..3daac57d28 100644 --- a/bc_obps/reporting/tests/service/test_report_verification_service.py +++ b/bc_obps/reporting/tests/service/test_report_verification_service.py @@ -9,13 +9,6 @@ class TestReportVerificationService(TestCase): - REGULATED_OPERATION_PURPOSES = { - Operation.Purposes.OBPS_REGULATED_OPERATION, - Operation.Purposes.OPTED_IN_OPERATION, - Operation.Purposes.NEW_ENTRANT_OPERATION, - } - ATTRIBUTABLE_EMISSION_THRESHOLD = Decimal('25000000') - def setUp(self): # Arrange: Create a report version self.report_version = make_recipe('reporting.tests.utils.report_version')