From fcf3a0c06a7d945b02f9da9b1321a5000c269a5b Mon Sep 17 00:00:00 2001 From: Jordan Witte Date: Thu, 23 May 2024 17:28:39 -0700 Subject: [PATCH] filter out counties with balances from list added to OSP form --- src/backend/expungeservice/form_filling.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/backend/expungeservice/form_filling.py b/src/backend/expungeservice/form_filling.py index d094d2802..3f8888573 100644 --- a/src/backend/expungeservice/form_filling.py +++ b/src/backend/expungeservice/form_filling.py @@ -697,8 +697,12 @@ def _create_and_write_pdf( @staticmethod def counties_with_cases_to_expunge(all_case_results: List[CaseResults]): - counties: List[str] = [] + counties_with_eligible_charge: List[str] = [] + counties_with_balances: List[str] = [] for case_result in all_case_results: - if case_result.has_eligible_charges and case_result.case.summary.location not in counties: - counties.append(case_result.case.summary.location) - return counties + if case_result.has_eligible_charges and case_result.case.summary.location not in counties_with_eligible_charge: + counties_with_eligible_charge.append(case_result.case.summary.location) + if case_result.case.summary.balance_due_in_cents != 0: + counties_with_balances.append(case_result.case.summary.location) + counties_with_expungements = [county for county in counties_with_eligible_charge if county not in counties_with_balances] + return counties_with_expungements