From abb0321c16f0ea76ac00462b4d6c0c0efcca0bcf Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Tue, 2 Jul 2024 11:32:43 -0700 Subject: [PATCH 1/7] 21777 add exclude future effective filing flag --- .../src/legal_api/services/involuntary_dissolution.py | 9 +++++---- .../business/business_checks/involuntary_dissolution.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/legal-api/src/legal_api/services/involuntary_dissolution.py b/legal-api/src/legal_api/services/involuntary_dissolution.py index 2962966ac3..d5c23063da 100644 --- a/legal-api/src/legal_api/services/involuntary_dissolution.py +++ b/legal-api/src/legal_api/services/involuntary_dissolution.py @@ -47,7 +47,7 @@ class EligibilityDetails: @classmethod def check_business_eligibility( - cls, identifier: str, exclude_in_dissolution=True + cls, identifier: str, exclude_in_dissolution=True, exclude_future_effective_filing=False ) -> Tuple[bool, EligibilityDetails]: """Return true if the business with provided identifier is eligible for dissolution. @@ -55,7 +55,7 @@ def check_business_eligibility( eligible (bool): True if the business is eligible for dissolution. eligibility_details (EligibilityDetails): Details regarding eligibility. """ - query = cls._get_businesses_eligible_query(exclude_in_dissolution).\ + query = cls._get_businesses_eligible_query(exclude_in_dissolution, exclude_future_effective_filing).\ filter(Business.identifier == identifier) result = query.one_or_none() @@ -94,7 +94,7 @@ def get_in_dissolution_batch_processing(business_id: int): one_or_none() @staticmethod - def _get_businesses_eligible_query(exclude_in_dissolution=True): + def _get_businesses_eligible_query(exclude_in_dissolution=True, exclude_future_effective_filing=False): """Return SQLAlchemy clause for fetching businesses eligible for involuntary dissolution. Args: @@ -125,6 +125,7 @@ def _get_businesses_eligible_query(exclude_in_dissolution=True): filter(Business.legal_type.in_(InvoluntaryDissolutionService.ELIGIBLE_TYPES)).\ filter(Business.no_dissolution.is_(False)) + future_effective_filing = False if exclude_future_effective_filing else _has_future_effective_filing() if exclude_in_dissolution: query = query.filter(not_(in_dissolution)) @@ -136,7 +137,7 @@ def _get_businesses_eligible_query(exclude_in_dissolution=True): ).\ filter( ~or_( - _has_future_effective_filing(), + future_effective_filing, _has_delay_of_dissolution_filing(), _is_limited_restored(), _is_xpro_from_nwpta() diff --git a/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py b/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py index 1249baaaa4..5774a7bfec 100644 --- a/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py +++ b/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py @@ -42,7 +42,7 @@ def check_business(business: Business) -> list: result.append(ar_overdue_warning) elif batch_datas := InvoluntaryDissolutionService.get_in_dissolution_batch_processing(business.id): batch_processing, _ = batch_datas - _, dis_details = InvoluntaryDissolutionService.check_business_eligibility(business.identifier, False) + _, dis_details = InvoluntaryDissolutionService.check_business_eligibility(business.identifier, False, True) if dis_details.transition_overdue: result.append(transition_warning) elif dis_details.ar_overdue: From 6b24a0285d5bb1240269f64b115713961141e993 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Tue, 2 Jul 2024 21:13:45 +0000 Subject: [PATCH 2/7] refactor: encapsulate the exclude_in_dissolution and exclude_future_effective_filing parameters --- .../src/legal_api/services/involuntary_dissolution.py | 11 +++++++++-- .../business_checks/involuntary_dissolution.py | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/legal-api/src/legal_api/services/involuntary_dissolution.py b/legal-api/src/legal_api/services/involuntary_dissolution.py index d5c23063da..d1f8f1d5d9 100644 --- a/legal-api/src/legal_api/services/involuntary_dissolution.py +++ b/legal-api/src/legal_api/services/involuntary_dissolution.py @@ -45,9 +45,16 @@ class EligibilityDetails: ar_overdue: bool transition_overdue: bool + @dataclass + class ExcludeDetails: + """Details about the exclude of a business for dissolution""" + + exclude_in_dissolution: bool = True + exclude_future_effective_filing: bool = False + @classmethod def check_business_eligibility( - cls, identifier: str, exclude_in_dissolution=True, exclude_future_effective_filing=False + cls, identifier: str, excludeDetails: ExcludeDetails ) -> Tuple[bool, EligibilityDetails]: """Return true if the business with provided identifier is eligible for dissolution. @@ -55,7 +62,7 @@ def check_business_eligibility( eligible (bool): True if the business is eligible for dissolution. eligibility_details (EligibilityDetails): Details regarding eligibility. """ - query = cls._get_businesses_eligible_query(exclude_in_dissolution, exclude_future_effective_filing).\ + query = cls._get_businesses_eligible_query(excludeDetails.exclude_in_dissolution, excludeDetails.exclude_future_effective_filing).\ filter(Business.identifier == identifier) result = query.one_or_none() diff --git a/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py b/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py index 5774a7bfec..67923830f3 100644 --- a/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py +++ b/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py @@ -34,7 +34,7 @@ def check_business(business: Business) -> list: 'warningType': WarningType.NOT_IN_GOOD_STANDING } - eligibility, details = InvoluntaryDissolutionService.check_business_eligibility(business.identifier, True) + eligibility, details = InvoluntaryDissolutionService.check_business_eligibility(business.identifier, InvoluntaryDissolutionService.ExcludeDetails(exclude_in_dissolution=True)) if eligibility: if details.transition_overdue: result.append(transition_warning) @@ -42,7 +42,7 @@ def check_business(business: Business) -> list: result.append(ar_overdue_warning) elif batch_datas := InvoluntaryDissolutionService.get_in_dissolution_batch_processing(business.id): batch_processing, _ = batch_datas - _, dis_details = InvoluntaryDissolutionService.check_business_eligibility(business.identifier, False, True) + _, dis_details = InvoluntaryDissolutionService.check_business_eligibility(business.identifier, InvoluntaryDissolutionService.ExcludeDetails(exclude_in_dissolution=False, exclude_future_effective_filing=True)) if dis_details.transition_overdue: result.append(transition_warning) elif dis_details.ar_overdue: From 720c912bf399bc95fba327d53c4dda91332e9f76 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Tue, 2 Jul 2024 22:01:13 +0000 Subject: [PATCH 3/7] refactor: encapsulate the exclude_in_dissolution and exclude_future_effective_filing parameters --- .../legal_api/services/involuntary_dissolution.py | 14 +++++++++++--- .../business_checks/involuntary_dissolution.py | 10 ++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/legal-api/src/legal_api/services/involuntary_dissolution.py b/legal-api/src/legal_api/services/involuntary_dissolution.py index d5c23063da..0c1a0091d4 100644 --- a/legal-api/src/legal_api/services/involuntary_dissolution.py +++ b/legal-api/src/legal_api/services/involuntary_dissolution.py @@ -45,9 +45,16 @@ class EligibilityDetails: ar_overdue: bool transition_overdue: bool + @dataclass + class ExcludeDetails: + """Details about the exclude of a business for dissolution.""" + + exclude_in_dissolution: bool = True + exclude_future_effective_filing: bool = False + @classmethod def check_business_eligibility( - cls, identifier: str, exclude_in_dissolution=True, exclude_future_effective_filing=False + cls, identifier: str, exclude_details: ExcludeDetails ) -> Tuple[bool, EligibilityDetails]: """Return true if the business with provided identifier is eligible for dissolution. @@ -55,8 +62,9 @@ def check_business_eligibility( eligible (bool): True if the business is eligible for dissolution. eligibility_details (EligibilityDetails): Details regarding eligibility. """ - query = cls._get_businesses_eligible_query(exclude_in_dissolution, exclude_future_effective_filing).\ - filter(Business.identifier == identifier) + query = cls._get_businesses_eligible_query( + exclude_details.exclude_in_dissolution, exclude_details.exclude_future_effective_filing + ).filter(Business.identifier == identifier) result = query.one_or_none() if result is None: diff --git a/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py b/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py index 5774a7bfec..572612f972 100644 --- a/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py +++ b/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py @@ -34,7 +34,9 @@ def check_business(business: Business) -> list: 'warningType': WarningType.NOT_IN_GOOD_STANDING } - eligibility, details = InvoluntaryDissolutionService.check_business_eligibility(business.identifier, True) + eligibility, details = InvoluntaryDissolutionService.check_business_eligibility( + business.identifier, InvoluntaryDissolutionService.ExcludeDetails(exclude_in_dissolution=True) + ) if eligibility: if details.transition_overdue: result.append(transition_warning) @@ -42,7 +44,11 @@ def check_business(business: Business) -> list: result.append(ar_overdue_warning) elif batch_datas := InvoluntaryDissolutionService.get_in_dissolution_batch_processing(business.id): batch_processing, _ = batch_datas - _, dis_details = InvoluntaryDissolutionService.check_business_eligibility(business.identifier, False, True) + _, dis_details = InvoluntaryDissolutionService.check_business_eligibility( + business.identifier, InvoluntaryDissolutionService.ExcludeDetails( + exclude_in_dissolution=False, exclude_future_effective_filing=True + ) + ) if dis_details.transition_overdue: result.append(transition_warning) elif dis_details.ar_overdue: From 0cfadb1b5a185dc0caa5b18ade740999a86af7ad Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Tue, 2 Jul 2024 15:52:58 -0700 Subject: [PATCH 4/7] update naming convention --- .../src/legal_api/services/involuntary_dissolution.py | 8 ++++---- .../business_checks/involuntary_dissolution.py | 10 ++++------ .../business_checks/test_involuntary_dissolution.py | 4 ++-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/legal-api/src/legal_api/services/involuntary_dissolution.py b/legal-api/src/legal_api/services/involuntary_dissolution.py index 0c1a0091d4..342377a716 100644 --- a/legal-api/src/legal_api/services/involuntary_dissolution.py +++ b/legal-api/src/legal_api/services/involuntary_dissolution.py @@ -46,7 +46,7 @@ class EligibilityDetails: transition_overdue: bool @dataclass - class ExcludeDetails: + class ExclusionSettings: """Details about the exclude of a business for dissolution.""" exclude_in_dissolution: bool = True @@ -54,7 +54,7 @@ class ExcludeDetails: @classmethod def check_business_eligibility( - cls, identifier: str, exclude_details: ExcludeDetails + cls, identifier: str, exclude_settings: ExclusionSettings = ExclusionSettings() ) -> Tuple[bool, EligibilityDetails]: """Return true if the business with provided identifier is eligible for dissolution. @@ -63,8 +63,8 @@ def check_business_eligibility( eligibility_details (EligibilityDetails): Details regarding eligibility. """ query = cls._get_businesses_eligible_query( - exclude_details.exclude_in_dissolution, exclude_details.exclude_future_effective_filing - ).filter(Business.identifier == identifier) + exclude_settings.exclude_in_dissolution, exclude_settings.exclude_future_effective_filing + ).filter(Business.identifier == identifier) result = query.one_or_none() if result is None: diff --git a/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py b/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py index 572612f972..912414c2d5 100644 --- a/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py +++ b/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py @@ -25,18 +25,16 @@ def check_business(business: Business) -> list: ar_overdue_warning = { 'code': BusinessWarningCodes.MULTIPLE_ANNUAL_REPORTS_NOT_FILED, - 'message': 'Multiple annual reports not filed. Eligible for involuntary dissolution.', + 'message': 'Multiple annual reports not filed. Eligible for involuntary dissolution.', 'warningType': WarningType.NOT_IN_GOOD_STANDING } transition_warning = { 'code': BusinessWarningCodes.TRANSITION_NOT_FILED, - 'message': 'Transition filing not filed. Eligible for involuntary dissolution.', + 'message': 'Transition filing not filed. Eligible for involuntary dissolution.', 'warningType': WarningType.NOT_IN_GOOD_STANDING } - eligibility, details = InvoluntaryDissolutionService.check_business_eligibility( - business.identifier, InvoluntaryDissolutionService.ExcludeDetails(exclude_in_dissolution=True) - ) + eligibility, details = InvoluntaryDissolutionService.check_business_eligibility(business.identifier) if eligibility: if details.transition_overdue: result.append(transition_warning) @@ -45,7 +43,7 @@ def check_business(business: Business) -> list: elif batch_datas := InvoluntaryDissolutionService.get_in_dissolution_batch_processing(business.id): batch_processing, _ = batch_datas _, dis_details = InvoluntaryDissolutionService.check_business_eligibility( - business.identifier, InvoluntaryDissolutionService.ExcludeDetails( + business.identifier, InvoluntaryDissolutionService.ExclusionSettings( exclude_in_dissolution=False, exclude_future_effective_filing=True ) ) diff --git a/legal-api/tests/unit/services/warnings/business/business_checks/test_involuntary_dissolution.py b/legal-api/tests/unit/services/warnings/business/business_checks/test_involuntary_dissolution.py index cfd2c29b6e..9f71591f82 100644 --- a/legal-api/tests/unit/services/warnings/business/business_checks/test_involuntary_dissolution.py +++ b/legal-api/tests/unit/services/warnings/business/business_checks/test_involuntary_dissolution.py @@ -90,9 +90,9 @@ def test_check_business(session, test_name, no_dissolution, batch_status, batch_ warning = result[0] if 'TRANSITION_OVERDUE' in test_name: assert warning['code'] == 'TRANSITION_NOT_FILED' - assert warning['message'] == 'Transition filing not filed. Eligible for involuntary dissolution.' + assert warning['message'] == 'Transition filing not filed. Eligible for involuntary dissolution.' assert warning['warningType'] == WarningType.NOT_IN_GOOD_STANDING else: assert warning['code'] == 'MULTIPLE_ANNUAL_REPORTS_NOT_FILED' - assert warning['message'] == 'Multiple annual reports not filed. Eligible for involuntary dissolution.' + assert warning['message'] == 'Multiple annual reports not filed. Eligible for involuntary dissolution.' assert warning['warningType'] == WarningType.NOT_IN_GOOD_STANDING From dacfacc2b75a3c65b6e847453ca61b4f1ac0ecf3 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Wed, 3 Jul 2024 09:04:03 -0700 Subject: [PATCH 5/7] add the tests --- .../business_checks/involuntary_dissolution.py | 4 +++- .../test_involuntary_dissolution.py | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py b/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py index 912414c2d5..e3481c6ad2 100644 --- a/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py +++ b/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py @@ -34,7 +34,9 @@ def check_business(business: Business) -> list: 'warningType': WarningType.NOT_IN_GOOD_STANDING } - eligibility, details = InvoluntaryDissolutionService.check_business_eligibility(business.identifier) + exclusion_settings = InvoluntaryDissolutionService.ExclusionSettings(exclude_future_effective_filing=True) + eligibility, details = InvoluntaryDissolutionService.check_business_eligibility(business.identifier, + exclusion_settings) if eligibility: if details.transition_overdue: result.append(transition_warning) diff --git a/legal-api/tests/unit/services/warnings/business/business_checks/test_involuntary_dissolution.py b/legal-api/tests/unit/services/warnings/business/business_checks/test_involuntary_dissolution.py index 9f71591f82..61ebdb0106 100644 --- a/legal-api/tests/unit/services/warnings/business/business_checks/test_involuntary_dissolution.py +++ b/legal-api/tests/unit/services/warnings/business/business_checks/test_involuntary_dissolution.py @@ -20,24 +20,30 @@ factory_batch, factory_batch_processing, factory_business, - factory_completed_filing + factory_completed_filing, + factory_pending_filing ) from legal_api.services.warnings.business.business_checks import WarningType from legal_api.services.warnings.business.business_checks.involuntary_dissolution import check_business from legal_api.utils.datetime import datetime from datedelta import datedelta -from registry_schemas.example_data import FILING_HEADER, RESTORATION, TRANSITION_FILING_TEMPLATE +from registry_schemas.example_data import CHANGE_OF_ADDRESS, FILING_HEADER, RESTORATION RESTORATION_FILING = copy.deepcopy(FILING_HEADER) RESTORATION_FILING['filing']['restoration'] = RESTORATION +CHANGE_OF_ADDRESS_FILING = copy.deepcopy(FILING_HEADER) +CHANGE_OF_ADDRESS_FILING['filing']['changeOfAddress'] = CHANGE_OF_ADDRESS + @pytest.mark.parametrize('test_name, no_dissolution, batch_status, batch_processing_status', [ ('NOT_ELIGIBLE', True, None, None), ('ELIGIBLE_AR_OVERDUE', False, 'PROCESSING', 'COMPLETED'), ('ELIGIBLE_TRANSITION_OVERDUE', False, 'PROCESSING', 'COMPLETED'), + ('ELIGIBLE_AR_OVERDUE_FUTURE_EFFECTIVE_FILING_HAS_WARNINGS', False, 'PROCESSING', 'COMPLETED'), ('IN_DISSOLUTION_AR_OVERDUE', False, 'PROCESSING', 'PROCESSING'), - ('IN_DISSOLUTION_TRANSITION_OVERDUE', False, 'PROCESSING', 'PROCESSING') + ('IN_DISSOLUTION_TRANSITION_OVERDUE', False, 'PROCESSING', 'PROCESSING'), + ('IN_DISSOLUTION_AR_OVERDUE_FUTURE_EFFECTIVE_FILING_HAS_WARNINGS', False, 'PROCESSING', 'PROCESSING'), ]) def test_check_business(session, test_name, no_dissolution, batch_status, batch_processing_status): """Test the check_business function.""" @@ -68,6 +74,9 @@ def test_check_business(session, test_name, no_dissolution, batch_status, batch_ batch_processing.meta_data = json.dumps(meta_data) batch_processing.save() + if 'FUTURE_EFFECTIVE_FILING' in test_name: + factory_pending_filing(business, CHANGE_OF_ADDRESS_FILING) + result = check_business(business) if test_name == 'NOT_ELIGIBLE': @@ -78,8 +87,10 @@ def test_check_business(session, test_name, no_dissolution, batch_status, batch_ assert result[1]['code'] == 'DISSOLUTION_IN_PROGRESS' assert result[1]['message'] == 'Business is in the process of involuntary dissolution.' assert result[1]['warningType'] == WarningType.INVOLUNTARY_DISSOLUTION + res_meta_data = json.loads(result[1]['data']) assert res_meta_data == meta_data + if 'TRANSITION_OVERDUE' in test_name: assert res_meta_data['overdueTransition'] == True else: From 2adfc035887b8f6de219bdeaf1a8f49ae72b578b Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Wed, 3 Jul 2024 11:31:47 -0700 Subject: [PATCH 6/7] update dataclass name --- .../business/business_checks/involuntary_dissolution.py | 7 +++---- queue_services/entity-filer/tests/__init__.py | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py b/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py index e3481c6ad2..14e7f5e016 100644 --- a/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py +++ b/legal-api/src/legal_api/services/warnings/business/business_checks/involuntary_dissolution.py @@ -34,9 +34,8 @@ def check_business(business: Business) -> list: 'warningType': WarningType.NOT_IN_GOOD_STANDING } - exclusion_settings = InvoluntaryDissolutionService.ExclusionSettings(exclude_future_effective_filing=True) - eligibility, details = InvoluntaryDissolutionService.check_business_eligibility(business.identifier, - exclusion_settings) + eligibility, details = InvoluntaryDissolutionService.check_business_eligibility( + business.identifier, InvoluntaryDissolutionService.EligibilityFilters(exclude_future_effective_filing=True)) if eligibility: if details.transition_overdue: result.append(transition_warning) @@ -45,7 +44,7 @@ def check_business(business: Business) -> list: elif batch_datas := InvoluntaryDissolutionService.get_in_dissolution_batch_processing(business.id): batch_processing, _ = batch_datas _, dis_details = InvoluntaryDissolutionService.check_business_eligibility( - business.identifier, InvoluntaryDissolutionService.ExclusionSettings( + business.identifier, InvoluntaryDissolutionService.EligibilityFilters( exclude_in_dissolution=False, exclude_future_effective_filing=True ) ) diff --git a/queue_services/entity-filer/tests/__init__.py b/queue_services/entity-filer/tests/__init__.py index 500aed22b5..8b9a49456e 100644 --- a/queue_services/entity-filer/tests/__init__.py +++ b/queue_services/entity-filer/tests/__init__.py @@ -71,3 +71,6 @@ def scan_list(orig_list, keys): key_set = set(keys) return del_key_in_dict(orig_dict, key_set) + + +# PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python pytest tests/unit/filing_processors/test_annual_report.py -x \ No newline at end of file From 81acaa877fb439aa287bb72b1d1bf584405c0914 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Wed, 3 Jul 2024 12:02:06 -0700 Subject: [PATCH 7/7] fix misc --- .../legal_api/services/involuntary_dissolution.py | 15 +++++++-------- queue_services/entity-filer/tests/__init__.py | 3 --- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/legal-api/src/legal_api/services/involuntary_dissolution.py b/legal-api/src/legal_api/services/involuntary_dissolution.py index 342377a716..353754c995 100644 --- a/legal-api/src/legal_api/services/involuntary_dissolution.py +++ b/legal-api/src/legal_api/services/involuntary_dissolution.py @@ -46,7 +46,7 @@ class EligibilityDetails: transition_overdue: bool @dataclass - class ExclusionSettings: + class EligibilityFilters: """Details about the exclude of a business for dissolution.""" exclude_in_dissolution: bool = True @@ -54,7 +54,7 @@ class ExclusionSettings: @classmethod def check_business_eligibility( - cls, identifier: str, exclude_settings: ExclusionSettings = ExclusionSettings() + cls, identifier: str, eligibility_filters: EligibilityFilters = EligibilityFilters() ) -> Tuple[bool, EligibilityDetails]: """Return true if the business with provided identifier is eligible for dissolution. @@ -62,9 +62,7 @@ def check_business_eligibility( eligible (bool): True if the business is eligible for dissolution. eligibility_details (EligibilityDetails): Details regarding eligibility. """ - query = cls._get_businesses_eligible_query( - exclude_settings.exclude_in_dissolution, exclude_settings.exclude_future_effective_filing - ).filter(Business.identifier == identifier) + query = cls._get_businesses_eligible_query(eligibility_filters).filter(Business.identifier == identifier) result = query.one_or_none() if result is None: @@ -102,7 +100,7 @@ def get_in_dissolution_batch_processing(business_id: int): one_or_none() @staticmethod - def _get_businesses_eligible_query(exclude_in_dissolution=True, exclude_future_effective_filing=False): + def _get_businesses_eligible_query(eligibility_filters: EligibilityFilters = EligibilityFilters()): """Return SQLAlchemy clause for fetching businesses eligible for involuntary dissolution. Args: @@ -133,8 +131,9 @@ def _get_businesses_eligible_query(exclude_in_dissolution=True, exclude_future_e filter(Business.legal_type.in_(InvoluntaryDissolutionService.ELIGIBLE_TYPES)).\ filter(Business.no_dissolution.is_(False)) - future_effective_filing = False if exclude_future_effective_filing else _has_future_effective_filing() - if exclude_in_dissolution: + future_effective_filing = False if eligibility_filters.exclude_future_effective_filing \ + else _has_future_effective_filing() + if eligibility_filters.exclude_in_dissolution: query = query.filter(not_(in_dissolution)) query = query.filter( diff --git a/queue_services/entity-filer/tests/__init__.py b/queue_services/entity-filer/tests/__init__.py index 8b9a49456e..500aed22b5 100644 --- a/queue_services/entity-filer/tests/__init__.py +++ b/queue_services/entity-filer/tests/__init__.py @@ -71,6 +71,3 @@ def scan_list(orig_list, keys): key_set = set(keys) return del_key_in_dict(orig_dict, key_set) - - -# PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python pytest tests/unit/filing_processors/test_annual_report.py -x \ No newline at end of file