Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

21777 add exclude future effective filing flag #2799

Merged
merged 8 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions legal-api/src/legal_api/services/involuntary_dissolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ 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
argush3 marked this conversation as resolved.
Show resolved Hide resolved
) -> Tuple[bool, EligibilityDetails]:
"""Return true if the business with provided identifier is eligible for dissolution.

Returns:
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()

Expand Down Expand Up @@ -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):
argush3 marked this conversation as resolved.
Show resolved Hide resolved
"""Return SQLAlchemy clause for fetching businesses eligible for involuntary dissolution.

Args:
eason-pan-bc marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -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))

Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down