home · contact · privacy
Fix Process.get_descendants eliminating sibling references to same Process.id_.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 2 Apr 2024 01:17:31 +0000 (03:17 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 2 Apr 2024 01:17:31 +0000 (03:17 +0200)
plomtask/processes.py
templates/process.html

index ba9707be5c407116d1bdd13f0f9210147942b25e..4f97f62f8a8d55527d77b0f66c8719f5e0d2e66b 100644 (file)
@@ -67,13 +67,13 @@ class Process:
         return process
 
     def get_descendants(self, db_conn: DatabaseConnection) ->\
-            dict[int, dict[str, object]]:
+            list[dict[str, object]]:
         """Return tree of descendant Processes"""
-        descendants = {}
+        descendants = []
         for id_ in self.child_ids:
             child = self.__class__.by_id(db_conn, id_)
-            descendants[id_] = {'process': child,
-                                'children': child.get_descendants(db_conn)}
+            descendants += [{'process': child,
+                             'children': child.get_descendants(db_conn)}]
         return descendants
 
     def save(self, db_conn: DatabaseConnection) -> None:
index f2d5055043da9388f488b37cf4336c6423dd1cab..0f0f0c5a49e5bef9db9b9eb558f7d416afedd4fa 100644 (file)
@@ -10,7 +10,7 @@
 <a href="process?id={{node.process.id_}}">{{node.process.title.newest|e}}</a>
 </td>
 </tr>
-{% for child in node.children.values() %}
+{% for child in node.children %}
 {{ process_with_children(child, indent+1) }}
 {% endfor %}
 {% endmacro %}
@@ -22,7 +22,7 @@ title: <input name="title" value="{{process.title.newest|e}}" />
 description: <input name="description" value="{{process.description.newest|e}}" />
 default effort: <input name="effort" type="number" step=0.1 value={{process.effort.newest}} />
 <table>
-{% for child in children.values() %}
+{% for child in children %}
 {{ process_with_children(child, 0) }}
 {% endfor %}
 </table>