+ def get_undone_steps_tree(self) -> TodoStepsNode:
+ """Return tree of depended-on undone Todos and Conditions."""
+
+ def walk_tree(node: TodoStepsNode) -> None:
+ if isinstance(node.item, Todo) and node.item.is_done:
+ node.hide = True
+ for child in node.children:
+ walk_tree(child)
+
+ seen_todos: set[int] = set()
+ seen_conditions: set[int] = set()
+ step_tree = self.get_step_tree(seen_todos, seen_conditions)
+ walk_tree(step_tree)
+ return step_tree
+
+ def get_done_steps_tree(self) -> list[TodoStepsNode]:
+ """Return tree of depended-on done Todos."""
+
+ def make_nodes(node: TodoStepsNode) -> list[TodoStepsNode]:
+ children: list[TodoStepsNode] = []
+ if not isinstance(node.item, Todo):
+ return children
+ for child in node.children:
+ children += make_nodes(child)
+ if node.item.is_done:
+ node.children = children
+ return [node]
+ return children
+
+ seen_todos: set[int] = set()
+ seen_conditions: set[int] = set()
+ step_tree = self.get_step_tree(seen_todos, seen_conditions)
+ nodes = make_nodes(step_tree)
+ return nodes
+