From: Christian Heller Date: Wed, 10 Apr 2024 04:36:15 +0000 (+0200) Subject: Hide already-seen descendants of implicit ProcessSteps. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bprefix%7D%7D/condition?a=commitdiff_plain;h=6034476a4d81e28c45e906cdcc36138bc28ccd55;p=plomtask Hide already-seen descendants of implicit ProcessSteps. --- diff --git a/plomtask/processes.py b/plomtask/processes.py index 23cded7..0a7d5b5 100644 --- a/plomtask/processes.py +++ b/plomtask/processes.py @@ -2,7 +2,7 @@ from __future__ import annotations from sqlite3 import Row from datetime import datetime -from typing import Any +from typing import Any, Set from plomtask.db import DatabaseConnection from plomtask.exceptions import NotFoundException, BadFormatException @@ -88,10 +88,13 @@ class Process: if s.parent_step_id == node_id] for child in explicit_children: node['steps'][child.id_] = make_node(child) + node['seen'] = node_id in seen_step_ids + seen_step_ids.add(node_id) for id_, step in node['steps'].items(): walk_steps(id_, step) steps: dict[int, dict[str, object]] = {} + seen_step_ids: Set[int] = set() if external_owner is None: external_owner = self for step in [s for s in self.explicit_steps diff --git a/templates/process.html b/templates/process.html index 0a15cc4..1dcfff6 100644 --- a/templates/process.html +++ b/templates/process.html @@ -11,7 +11,11 @@ {% endif %} {% for i in range(indent) %}+{%endfor %} +{% if (not step_node.is_explicit) and step_node.seen %} +({{step_node.process.title.newest|e}}) +{% else %} {{step_node.process.title.newest|e}} +{% endif %} {% if step_node.is_explicit %} @@ -19,9 +23,11 @@ add step: