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

Handle case numbers without number and year #1420

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Changes from all commits
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
14 changes: 13 additions & 1 deletion peachjam/models/judgment.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,19 @@ def __str__(self):
def get_case_number_string(self):
if self.string_override:
return self.string_override
return f"{self.matter_type or ''} {self.number} of {self.year}".strip()

parts = []

if self.matter_type:
parts.append(self.matter_type.name)

if self.number:
parts.append(str(self.number))

if self.year:
parts.append(f"of {self.year}" if parts else str(self.year))

return " ".join(parts)

def save(self, *args, **kwargs):
self.string = self.get_case_number_string()
Expand Down
Loading