From cc2fa6f35be0978af6ad87a32f0ab7826754695a Mon Sep 17 00:00:00 2001 From: lemoer Date: Sun, 29 Dec 2024 00:40:25 +0100 Subject: [PATCH] Task: add unfulfillable_message_sent property --- main.py | 5 ++--- models.py | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index fbcf728..1963294 100644 --- a/main.py +++ b/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: diff --git a/models.py b/models.py index 4058c68..e51505f 100644 --- a/models.py +++ b/models.py @@ -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")