From: Christian Heller Date: Tue, 2 Apr 2024 01:17:31 +0000 (+0200) Subject: Fix Process.get_descendants eliminating sibling references to same Process.id_. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/static/pick_tasks?a=commitdiff_plain;h=b96a5c72c2decc56ca1706e4929e2e58e4b7b156;p=plomtask Fix Process.get_descendants eliminating sibling references to same Process.id_. --- diff --git a/plomtask/processes.py b/plomtask/processes.py index ba9707b..4f97f62 100644 --- a/plomtask/processes.py +++ b/plomtask/processes.py @@ -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: diff --git a/templates/process.html b/templates/process.html index f2d5055..0f0f0c5 100644 --- a/templates/process.html +++ b/templates/process.html @@ -10,7 +10,7 @@ {{node.process.title.newest|e}} -{% for child in node.children.values() %} +{% for child in node.children %} {{ process_with_children(child, indent+1) }} {% endfor %} {% endmacro %} @@ -22,7 +22,7 @@ title: description: default effort: -{% for child in children.values() %} +{% for child in children %} {{ process_with_children(child, 0) }} {% endfor %}