X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;f=plomtask%2Ftodos.py;h=43ada0b6a04f3df387c1f1933356e1e2b1832fbc;hb=aed1d5968abf97976db3725347fe4e7672c935e7;hp=2b9fd1d8edb2fa159f3955f469a6b3d394aa1efa;hpb=12195a1fe2c15334c866036eaa171eb8e92f0408;p=plomtask diff --git a/plomtask/todos.py b/plomtask/todos.py index 2b9fd1d..43ada0b 100644 --- a/plomtask/todos.py +++ b/plomtask/todos.py @@ -61,6 +61,14 @@ class Todo: todos += [cls.by_id(db_conn, row[0])] return todos + @property + def is_doable(self) -> bool: + """Decide whether .is_done can be set to True based on children's.""" + for child in self.children: + if not child.is_done: + return False + return True + def add_child(self, child: Todo) -> None: """Add child to self.children, guard against recursion""" def walk_steps(node: Todo) -> None: