Task: fix when no additional_requests_to_be_sent() in create_additional_requests()

This commit is contained in:
lemoer 2024-12-21 05:42:19 +01:00
parent 947f31ad96
commit 76ec1c0923

View File

@ -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):