Task: add unfulfillable_message_sent property
This commit is contained in:
parent
05bbf2f8d1
commit
cc2fa6f35b
5
main.py
5
main.py
@ -454,7 +454,6 @@ As soon as {request.task.required_number_of_participants} people joined the task
|
||||
# Async routine that syncs active members using sync_members_as_active_users(),
|
||||
# sends out new requests for tasks to active users and handles timeouts for the
|
||||
# requests.
|
||||
unfulfillable_tasks = []
|
||||
|
||||
while True:
|
||||
self.assert_is_base_group_admin()
|
||||
@ -473,13 +472,13 @@ As soon as {request.task.required_number_of_participants} people joined the task
|
||||
reqs = task.create_additional_requests(now(), session)
|
||||
|
||||
if is_err(reqs):
|
||||
if task not in unfulfillable_tasks and len(task.accepted_requests()) > 0:
|
||||
if not task.unfulfillable_message_sent and len(task.accepted_requests()) > 0:
|
||||
print("Could not fulfill task: " + task.name)
|
||||
additional_requested_users = [r.user.name for r in task.requested_requests()]
|
||||
|
||||
self.api.send_message(SendMessageSimple(message=f"It was planned to do this task with {task.required_number_of_participants} participants. There are currently {len(additional_requested_users)} unanswered requests. However, currently, no additional users are left to request for this task. Please try to fulfill the tasks as good as you are able to within your group or ask other people directly if they can join your group." + self.pad_hint(task), recipients=[task.chatgroup]))
|
||||
|
||||
unfulfillable_tasks.append(task)
|
||||
task.unfulfillable_message_sent = True
|
||||
|
||||
reqs = reqs.unwrap_err()
|
||||
else:
|
||||
|
@ -86,6 +86,7 @@ class Task(SQLModel, table=True):
|
||||
timeout: int # in seconds
|
||||
chatgroup: str | None = None # None = to be created
|
||||
pad_url: str | None = None # optional pad url
|
||||
unfulfillable_message_sent: bool = False
|
||||
|
||||
participation_requests: list["ParticipationRequest"] = Relationship(back_populates="task")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user