Skip to content

Commit 4c4f2af

Browse files
committed
Boost scores for tasks in rooms that the member cares about.
1 parent c1e10c5 commit 4c4f2af

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

api/src/tasks/delegate.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,9 +1172,9 @@ def score_calculation_summary(self, line_prefix: str = "", column_width: int = 0
11721172
current_score = op.value
11731173
lines.append(f"{line_prefix}= {v_str} => {current_score:.2f}")
11741174

1175-
assert (
1176-
abs(current_score - self.score) < 0.0001
1177-
), f"Score calculation mismatch: calculated {current_score}, expected {self.score}"
1175+
assert abs(current_score - self.score) < 0.0001, (
1176+
f"Score calculation mismatch: calculated {current_score}, expected {self.score}"
1177+
)
11781178
return "\n".join(lines)
11791179

11801180

@@ -1329,8 +1329,10 @@ def task_score(
13291329

13301330
# Check room preferences
13311331
if requirements.location is not None and ctx.member.preferred_rooms is not None:
1332-
if requirements.location not in ctx.member.preferred_rooms:
1333-
score.multiply_score(0.1, f"Task is '{requirements.location}' which isn't a preferred room for the member")
1332+
if requirements.location in ctx.member.preferred_rooms:
1333+
score.multiply_score(1.5, f"'{requirements.location}' is a preferred room for the member")
1334+
else:
1335+
score.multiply_score(0.1, f"'{requirements.location}' isn't a preferred room for the member")
13341336

13351337
# Score: (weight * frequency * (1 + overdue_frequency_intervals)) / (how many members in the past 30 days have been assignable to this task)
13361338
# Can be assigned task: (last completed task size) - (hours spent at space since last completed task)

0 commit comments

Comments
 (0)