From 6034476a4d81e28c45e906cdcc36138bc28ccd55 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Wed, 10 Apr 2024 06:36:15 +0200 Subject: [PATCH] Hide already-seen descendants of implicit ProcessSteps. --- plomtask/processes.py | 5 ++++- templates/process.html | 6 ++++++ tests/processes.py | 14 +++++++------- 3 files changed, 17 insertions(+), 8 deletions(-) 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: