Skip to content

Commit

Permalink
Merge pull request #1589 from KentShikama/statewide-form
Browse files Browse the repository at this point in the history
Replace county forms with 2022 state-wide form
  • Loading branch information
KentShikama authored Jan 27, 2022
2 parents 0cc9e52 + 83d2f7c commit 986be57
Show file tree
Hide file tree
Showing 43 changed files with 122 additions and 227 deletions.
Binary file removed src/backend/expungeservice/files/baker_arrest.pdf
Binary file not shown.
Binary file not shown.
Binary file removed src/backend/expungeservice/files/benton_arrest.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed src/backend/expungeservice/files/coos_arrest.pdf
Binary file not shown.
Binary file removed src/backend/expungeservice/files/coos_conviction.pdf
Binary file not shown.
Binary file removed src/backend/expungeservice/files/curry_arrest.pdf
Binary file not shown.
Binary file not shown.
Binary file removed src/backend/expungeservice/files/jackson_arrest.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed src/backend/expungeservice/files/lane_arrest.pdf
Binary file not shown.
Binary file removed src/backend/expungeservice/files/lane_conviction.pdf
Binary file not shown.
Binary file removed src/backend/expungeservice/files/lincoln_arrest.pdf
Binary file not shown.
Binary file not shown.
Binary file removed src/backend/expungeservice/files/linn_arrest.pdf
Binary file not shown.
Binary file removed src/backend/expungeservice/files/linn_conviction.pdf
Binary file not shown.
Binary file removed src/backend/expungeservice/files/marion_arrest.pdf
Binary file not shown.
Binary file not shown.
Binary file removed src/backend/expungeservice/files/morrow_arrest.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added src/backend/expungeservice/files/oregon.pdf
Binary file not shown.
Binary file removed src/backend/expungeservice/files/polk_arrest.pdf
Binary file not shown.
Binary file not shown.
Binary file removed src/backend/expungeservice/files/stock_arrest.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed src/backend/expungeservice/files/yamhill_arrest.pdf
Binary file not shown.
Binary file not shown.
306 changes: 118 additions & 188 deletions src/backend/expungeservice/form_filling.py

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions src/backend/expungeservice/models/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ def has_eligible_conviction(self):
dismissals, convictions = Case.categorize_charges(eligible_charges)
return len(convictions) > 0

def qualifying_marijuana_conviction_form_applicable(self):
eligible_charges, ineligible_charges = Case.partition_by_eligibility(self.charges)
for charge in eligible_charges:
if not charge.is_qualifying_mj_conviction():
return False
return True

@staticmethod
def partition_by_eligibility(charges: Tuple[Charge, ...]):
ineligible_charges_generator, eligible_charges_generator = partition(
Expand Down
11 changes: 3 additions & 8 deletions src/backend/expungeservice/models/charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ def _default_type_eligibility(self):
def case(self, cases):
return next(case for case in cases if case.summary.case_number == self.case_number)

def no_complaint(self):
return self.disposition.status == DispositionStatus.NO_COMPLAINT

def dismissed(self):
return ChargeUtil.dismissed(self.disposition)

Expand All @@ -116,11 +119,3 @@ def to_one_line(self) -> str:
charged_date = self.date.strftime("%b %-d, %Y")
disposition = str(self.disposition.status.name)
return f"{short_name} ({disposition}) Charged {charged_date}"

def is_qualifying_mj_conviction(self):
# See https://www.oregonlaws.org/ors/475B.401
from expungeservice.models.charge_types.marijuana_eligible import MarijuanaViolation

is_qualifying_type = "Poss LT 1 Oz Marijuana" in self.name or isinstance(self.charge_type, MarijuanaViolation)
is_qualifying_date = self.date < date_class(2015, 7, 1)
return is_qualifying_type and is_qualifying_date and self.convicted()
25 changes: 1 addition & 24 deletions src/backend/tests/test_form_filling.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from tests.factories.crawler_factory import CrawlerFactory
from tests.fixtures.case_details import CaseDetails
from tests.fixtures.john_doe import JohnDoe
from tests.test_crawler_expunger import record_with_mj_over_21


def test_normal_conviction_uses_multnomah_conviction_form():
Expand All @@ -32,26 +31,4 @@ def test_normal_conviction_uses_multnomah_conviction_form():
zip_ref.extractall(temp_dir)
for _root, _dir, files in os.walk(temp_dir):
assert len(files) == 1
assert "multnomah_conviction" in files[0]


def test_marijuana_violation_uses_statewide_form(record_with_mj_over_21):
expunger_result = Expunger.run(record_with_mj_over_21)
merged_record = RecordMerger.merge([record_with_mj_over_21], [expunger_result], [])
record_summary = RecordSummarizer.summarize(merged_record, {})
user_information = {
"full_name": "",
"date_of_birth": "",
"mailing_address": "",
"phone_number": "",
"city": "",
"state": "",
"zip_code": "",
}
zip_path, zip_name = FormFilling.build_zip(record_summary, user_information)
temp_dir = mkdtemp()
with ZipFile(zip_path, "r") as zip_ref:
zip_ref.extractall(temp_dir)
for _root, _dir, files in os.walk(temp_dir):
assert len(files) == 1
assert "statewide_marijuana_conviction" in files[0]
assert "oregon" in files[0]

0 comments on commit 986be57

Please sign in to comment.