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:
<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 %}
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>