diff --git a/models.py b/models.py index 72746c6..5e20961 100644 --- a/models.py +++ b/models.py @@ -110,7 +110,8 @@ class Task(SQLModel, table=True): for _ in range(self.additional_requests_to_be_sent()): user = next_user_to_send_request(session, self) if user is None: - break + # Incomplete requests + return Err(additional_requests) request = ParticipationRequest( user=user, @@ -120,11 +121,7 @@ class Task(SQLModel, table=True): session.add(request) additional_requests.append(request) - if user is None: - # Incomplete requests - return Err(additional_requests) - else: - return Ok(additional_requests) + return Ok(additional_requests) class ParticipationState(enum.Enum):