From 63073c2c05785d2b5539780dd5bc40adff57aab1 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Thu, 30 May 2024 06:55:31 +0200 Subject: [PATCH] To Condition view, add listings of related Processes. --- plomtask/http.py | 8 +++++++- templates/condition.html | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/plomtask/http.py b/plomtask/http.py index 8255aa2..b81083b 100644 --- a/plomtask/http.py +++ b/plomtask/http.py @@ -207,7 +207,13 @@ class TaskHandler(BaseHTTPRequestHandler): def do_GET_condition(self) -> dict[str, object]: """Show Condition of ?id=.""" id_ = self.params.get_int_or_none('id') - return {'condition': Condition.by_id(self.conn, id_, create=True)} + c = Condition.by_id(self.conn, id_, create=True) + ps = Process.all(self.conn) + return {'condition': c, + 'enabled_processes': [p for p in ps if c in p.conditions], + 'disabled_processes': [p for p in ps if c in p.blockers], + 'enabling_processes': [p for p in ps if c in p.enables], + 'disabling_processes': [p for p in ps if c in p.disables]} def do_GET_condition_titles(self) -> dict[str, object]: """Show title history of Condition of ?id=.""" diff --git a/templates/condition.html b/templates/condition.html index 1fc5902..324c8f8 100644 --- a/templates/condition.html +++ b/templates/condition.html @@ -23,6 +23,42 @@ {% if condition.id_ %} [history]{% endif %} + +enables + +{% for process in enabled_processes %} +{{process.title.newest|e}}
+{% endfor %} + + + + +disables + +{% for process in disabled_processes %} +{{process.title.newest|e}}
+{% endfor %} + + + + +enabled by + +{% for process in enabling_processes %} +{{process.title.newest|e}}
+{% endfor %} + + + + +disabled by + +{% for process in disabling_processes %} +{{process.title.newest|e}}
+{% endfor %} + + + {{ macros.edit_buttons() }} {% endblock %} -- 2.30.2