From 76ec1c09231926c5ce370202a6f92f26cc041387 Mon Sep 17 00:00:00 2001 From: lemoer Date: Sat, 21 Dec 2024 05:42:19 +0100 Subject: [PATCH] Task: fix when no additional_requests_to_be_sent() in create_additional_requests() --- models.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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):