Skip to content

Commit

Permalink
Merge pull request #1627 from KentShikama/kent-multnomah-forms
Browse files Browse the repository at this point in the history
Ensure Multnomah uses old forms and remove old forms otherwise
  • Loading branch information
KentShikama authored Sep 29, 2022
2 parents f9529cf + e9fdf5b commit 25a376c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 350 deletions.
25 changes: 12 additions & 13 deletions src/backend/expungeservice/form_filling.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from expungeservice.models.charge_types.reduced_to_violation import ReducedToViolation
from expungeservice.models.charge_types.violation import Violation
from expungeservice.models.record_summary import RecordSummary
from expungeservice.old_form_filling import FormFilling as OldFormFilling
from expungeservice.pdf.markdown_to_pdf import MarkdownToPDF

from pdfrw import PdfReader, PdfWriter, PdfDict, PdfObject
Expand Down Expand Up @@ -116,11 +115,6 @@ def build_zip(record_summary: RecordSummary, user_information: Dict[str, str]) -
trailer.Root.AcroForm = pdf.Root.AcroForm
writer.write(file_path, trailer=trailer)
zipfile.write(file_path, file_name)

# TODO: Remove
old_zip_path, old_zip_name = OldFormFilling.build_zip(record_summary, user_information)
zipfile.write(old_zip_path, old_zip_name)

zipfile.close()
return zip_path, zip_name

Expand Down Expand Up @@ -363,16 +357,21 @@ def _build_pdf_path(location: str, convictions: List[Charge]) -> str:
return path.join(Path(__file__).parent, "files", "oregon_with_conviction_order.pdf")
else:
return path.join(Path(__file__).parent, "files", "oregon_with_arrest_order.pdf")
elif location == "multnomah":
if convictions:
return path.join(Path(__file__).parent, "files", "multnomah_conviction.pdf")
else:
return path.join(Path(__file__).parent, "files", "multnomah_arrest.pdf")
else:
return path.join(Path(__file__).parent, "files", "oregon.pdf")

@staticmethod
def _build_base_file_name(location: str, convictions: List[Charge]) -> str:
# Douglas and Umatilla counties explicitly want the "Order" part of the old forms too.
if location in ["douglas", "umatilla"]:
if convictions:
return path.join(Path(__file__).parent, "files", f"{location}_with_conviction_order.pdf")
else:
return path.join(Path(__file__).parent, "files", f"{location}_with_arrest_order.pdf")
# Douglas and Umatilla counties explicitly want the "Order" part of the old forms too.
if location in ["douglas", "umatilla"]:
if convictions:
return path.join(Path(__file__).parent, "files", f"{location}_with_conviction_order.pdf")
else:
return path.join(Path(__file__).parent, "files", f"{location}.pdf")
return path.join(Path(__file__).parent, "files", f"{location}_with_arrest_order.pdf")
else:
return path.join(Path(__file__).parent, "files", f"{location}.pdf")
336 changes: 0 additions & 336 deletions src/backend/expungeservice/old_form_filling.py

This file was deleted.

2 changes: 1 addition & 1 deletion src/backend/tests/test_form_filling.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ def test_normal_conviction_uses_multnomah_conviction_form():
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) == 3
assert len(files) == 2

0 comments on commit 25a376c

Please sign in to comment.