X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;ds=inline;f=plomtask%2Ftodos.py;h=4e3a4dba247bd88e5ba3bbf1a33fac49b779bd94;hb=4c0b3ff23b3d9fc526dfaa4803eb167d64c32181;hp=e42c484a56e56e5bcf35b3c8a0c801270619f5bf;hpb=bdb37bdbfdc46a64631c0fb97d0d86540076165e;p=plomtask diff --git a/plomtask/todos.py b/plomtask/todos.py index e42c484..4e3a4db 100644 --- a/plomtask/todos.py +++ b/plomtask/todos.py @@ -126,13 +126,16 @@ class Todo(BaseModel[int], ConditionsRelations): for condition in self.disables: condition.is_active = False - def adopt_from(self, todos: list[Todo]) -> None: + 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."""