Skip to content

Commit c1e10c5

Browse files
committed
Minor tweak to task delegation.
1 parent 6985518 commit c1e10c5

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
ALTER TABLE task_delegation_log
2+
MODIFY COLUMN action ENUM(
3+
'assigned',
4+
'completed',
5+
'not_done_did_something_else',
6+
'not_done_confused',
7+
'not_done_forgot',
8+
'not_done_no_time',
9+
'not_done_other',
10+
'not_done_rerolled',
11+
'ignored',
12+
'already_completed_by_someone_else'
13+
) NOT NULL;

api/src/tasks/delegate.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,12 @@ def member_recently_received_task(ctx: TaskContext) -> bool:
10561056
# If a member has been assigned (but not necessarily completed) a task recently, don't assign them another one too soon.
10571057
# This can be relevant if a member quickly says that they cannot complete a task for some reason.
10581058
# It's then no longer assigned or completed, but we still don't want to assign them another task too soon.
1059-
if ctx.time - last_assigned_task.created_at < timedelta(hours=14):
1059+
#
1060+
# If the member explicitly wanted a new task, we allow assigning a new task sooner.
1061+
if (
1062+
ctx.time - last_assigned_task.created_at < timedelta(hours=14)
1063+
and last_assigned_task.status != "not_done_rerolled"
1064+
):
10601065
return True
10611066

10621067
return False

api/src/tasks/models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class TaskDelegationLog(Base):
2525
"not_done_forgot",
2626
"not_done_no_time",
2727
"not_done_other",
28+
"not_done_rerolled",
2829
"ignored",
2930
"already_completed_by_someone_else",
3031
]
@@ -52,6 +53,7 @@ class TaskDelegationLog(Base):
5253
"not_done_forgot",
5354
"not_done_no_time",
5455
"not_done_other",
56+
"not_done_rerolled",
5557
"ignored",
5658
"already_completed_by_someone_else",
5759
name="task_action",

api/src/tasks/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def slack_handle_task_feedback(payload: SlackInteraction, ignore_reasons: list[s
373373
member.member_id, slack_interaction=None, force=True, ignore_reasons=ignore_reasons
374374
)
375375
else:
376-
log.action = "not_done_other" # TODO: Replace by "rerolled" or something
376+
log.action = "not_done_rerolled"
377377
logger.info(f"Member #{member.member_number} {member.firstname} {member.lastname} requested a new task")
378378
db_session.commit()
379379

0 commit comments

Comments
 (0)