From 5330c790adbff45a76988d6483ab0175cb95da77 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 6 Jun 2024 03:16:34 +0200
Subject: [PATCH] Minor ProcessStep management bug fixes.

---
 plomtask/http.py       | 4 ++--
 templates/process.html | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/plomtask/http.py b/plomtask/http.py
index f28b097..f6c5dc7 100644
--- a/plomtask/http.py
+++ b/plomtask/http.py
@@ -376,8 +376,6 @@ class TaskHandler(BaseHTTPRequestHandler):
         process.set_blockers(self.conn, self.form_data.get_all_int('blocker'))
         process.set_enables(self.conn, self.form_data.get_all_int('enables'))
         process.set_disables(self.conn, self.form_data.get_all_int('disables'))
-        process.set_step_suppressions(self.conn,
-                                      self.form_data.get_all_int('suppresses'))
         process.calendarize = self.form_data.get_all_str('calendarize') != []
         process.save(self.conn)
         assert isinstance(process.id_, int)
@@ -403,6 +401,8 @@ class TaskHandler(BaseHTTPRequestHandler):
             steps += [ProcessStep(None, process.id_, step_process_id, None)]
         process.uncache()
         process.set_steps(self.conn, steps)
+        process.set_step_suppressions(self.conn,
+                                      self.form_data.get_all_int('suppresses'))
         process.save(self.conn)
         return f'/process?id={process.id_}'
 
diff --git a/templates/process.html b/templates/process.html
index 200c6ea..bc8d6e6 100644
--- a/templates/process.html
+++ b/templates/process.html
@@ -25,7 +25,7 @@
 <td>
 {% if step_node.is_explicit %}
 add sub-step: <input name="new_step_to_{{step_id}}" list="step_candidates" autocomplete="off" />
-{% elif step_node.seen %}
+{% elif not step_node.seen %}
 <input type="checkbox" name="suppresses" value="{{step_id}}" {% if step_node.is_suppressed %}checked{% endif %}> suppress
 {% endif %}
 </td>
-- 
2.30.2