Skip to content

Commit 13cff9b

Browse files
committed
Improve task delegator docs.
1 parent 94e74cd commit 13cff9b

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

api/src/tasks/delegate.py

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,16 @@ class SlackInteraction:
121121

122122
@serde
123123
class TaskDelegationLogSimple:
124+
# ID of the log entry in the database
124125
log_id: int
126+
# ID of the trello card
125127
card_id: str
126-
# template_card_id: str | None
127128
status: TaskDelegationLog.ACTION_TYPE
129+
# Name of the trello card
128130
card_name: str
131+
# When the log entry was created
129132
created_at: datetime
133+
# Size of the task
130134
size: TaskSize
131135

132136
@staticmethod
@@ -539,12 +543,25 @@ def from_card(card: trello.TrelloCard) -> "CardCompletionInfo":
539543

540544
@dataclass
541545
class CardRequirements:
546+
# List of (requirement name, requirement function) tuples.
542547
required: Sequence[Tuple[str, Callable[[TaskContext], bool]]]
548+
549+
# Size of the task
543550
size: TaskSize
551+
552+
# In which room the task is located
544553
location: str | None
554+
555+
# Which machine the task is associated with
545556
machine: str | None
557+
558+
# Messages to show when assigning the task to a member
546559
introduction_message: list[Callable[[TaskContext], str | None]]
560+
561+
# Messages to show when completing the task
547562
completion_message: list[Callable[[TaskContext], str | None]]
563+
564+
# Task description
548565
description: str
549566

550567
# If set, the average interval at which this task repeats.
@@ -604,27 +621,6 @@ def has_label(label_name: str) -> bool:
604621
return True
605622
return False
606623

607-
# label("Room: Big room").requires(door_opened("UUID") or door_opened("UUID"))
608-
# label("Room: Textile workshop").requires(door_opened("UUID"))
609-
610-
# label("Machine: Laser").requires(purchased_product_count("Laser Minutes", member_id=member_id, days=30) > 50)
611-
# # label("Machine: Laser").ask_before_assigning("Are you using the laser today?")
612-
613-
# label("Cleaning").score(2 if is_evening() or is_morning() else 1)
614-
615-
# label("Room Developer: Wood").requires(is_part_of_group("Room Developers: Wood") or is_part_of_group("Styrelsen"))
616-
617-
# label("Level: 3").requires(previously_completed_tasks(label("Level: 2")) >= 2)
618-
# label("Level: 3").requires(unique_months_visited() >= 3)
619-
620-
# label("Level: 2").requires(previously_completed_tasks(label("Level: 1")) >= 3)
621-
622-
# label("Size: Medium").requires(previously_completed_tasks() >= 5)
623-
# label("Size: Large").requires(previously_completed_tasks() >= 10)
624-
625-
# label("Size: Large").size(16)
626-
# label("Size: Medium").size(8)
627-
628624
for label in labels:
629625
if label.startswith("Room: "):
630626
checked_labels.add(label)
@@ -1037,9 +1033,9 @@ def score_calculation_summary(self, line_prefix: str = "", column_width: int = 0
10371033
current_score = op.value
10381034
lines.append(f"{line_prefix}= {v_str} => {current_score:.2f}")
10391035

1040-
assert (
1041-
abs(current_score - self.score) < 0.0001
1042-
), f"Score calculation mismatch: calculated {current_score}, expected {self.score}"
1036+
assert abs(current_score - self.score) < 0.0001, (
1037+
f"Score calculation mismatch: calculated {current_score}, expected {self.score}"
1038+
)
10431039
return "\n".join(lines)
10441040

10451041

0 commit comments

Comments
 (0)