Skip to content

Commit

Permalink
Update case service to return only lists for get_participants (#4219)
Browse files Browse the repository at this point in the history
Changed return type to be only a list for get_participants, but allow participants list to be empty.
  • Loading branch information
jschroth authored Jan 9, 2024
1 parent c6fb835 commit 053b758
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dispatch/case/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def delete(*, db_session, case_id: int):

def get_participants(
*, db_session: Session, case_id: int, minimal: bool = False
) -> list[Participant] | None:
) -> list[Participant]:
"""Returns a list of participants based on the given case id."""
if minimal:
case = (
Expand All @@ -390,4 +390,4 @@ def get_participants(
.first()
)

return case.participants if case else None
return [] if case is None or case.participants is None else case.participants

0 comments on commit 053b758

Please sign in to comment.