home · contact · privacy
On POSTing new Todos on Day view, ensure possible adoptions within them.
[plomtask] / plomtask / todos.py
index e42c484a56e56e5bcf35b3c8a0c801270619f5bf..4e3a4dba247bd88e5ba3bbf1a33fac49b779bd94 100644 (file)
@@ -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."""