From: Christian Heller Date: Thu, 30 May 2024 04:55:31 +0000 (+0200) Subject: To Condition view, add listings of related Processes. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%22https:/validator.w3.org/ledger?a=commitdiff_plain;h=63073c2c05785d2b5539780dd5bc40adff57aab1;p=plomtask To Condition view, add listings of related Processes. --- 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 %}