- def get_step_tree(self, seen_todos: set[int],
- seen_conditions: set[int]) -> TodoStepsNode:
- """Return tree of depended-on Todos and Conditions."""
+ @property
+ def title(self) -> VersionedAttribute:
+ """Shortcut to .process.title."""
+ return self.process.title
+
+ @property
+ def title_then(self) -> str:
+ """Shortcut to .process.title.at(self.date)"""
+ title_then = self.process.title.at(self.date)
+ assert isinstance(title_then, str)
+ return title_then
+
+ @property
+ def effort_then(self) -> float:
+ """Shortcut to .process.effort.at(self.date)"""
+ effort_then = self.process.effort.at(self.date)
+ assert isinstance(effort_then, float)
+ return effort_then
+
+ def adopt_from(self, todos: list[Todo]) -> bool:
+ """As far as possible, fill unsatisfied dependencies from todos."""
+ adopted = False
+ for process_id in self.unsatisfied_dependencies:
+ for todo in [t for t in todos if t.process.id_ == process_id
+ and t not in self.children]:
+ self.add_child(todo)
+ adopted = True
+ break
+ return adopted
+
+ def make_missing_children(self, db_conn: DatabaseConnection) -> None:
+ """Fill unsatisfied dependencies with new Todos."""
+ new_todos = self.__class__.create_with_children(
+ db_conn, self.date, self.unsatisfied_dependencies)
+ for todo in new_todos:
+ self.add_child(todo)