X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/move_up?a=blobdiff_plain;f=plomtask%2Ftodos.py;h=69a19c94f1e5b172dd14be0fa72fc4a4e7752fe1;hb=80025e0b2d278a44852b6a397184d1f71c2075fe;hp=775ef486440b7d3b5715ff2cf845b40bc5d36a7e;hpb=c64a6dcd83cd13f5cc534325feac0554cf289a81;p=plomtask diff --git a/plomtask/todos.py b/plomtask/todos.py index 775ef48..69a19c9 100644 --- a/plomtask/todos.py +++ b/plomtask/todos.py @@ -214,6 +214,18 @@ class Todo(BaseModel[int], ConditionsRelations): assert isinstance(effort_then, float) return effort_then + @property + def has_doneness_in_path(self) -> bool: + """Check whether self is done or has any children that are.""" + if self.is_done: + return True + for child in self.children: + if child.is_done: + return True + if child.has_doneness_in_path: + return True + return False + def get_step_tree(self, seen_todos: set[int]) -> TodoNode: """Return tree of depended-on Todos."""