From: Christian Heller <c.heller@plomlompom.de>
Date: Sun, 9 Jun 2024 05:30:46 +0000 (+0200)
Subject: Simplify and improve previous bugfix.
X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Bdb.prefix%7D%7D/todos?a=commitdiff_plain;h=6c3fca10aa663422abc48b96b38628dc2771701a;p=plomtask

Simplify and improve previous bugfix.
---

diff --git a/plomtask/http.py b/plomtask/http.py
index 44c710b..71305b2 100644
--- a/plomtask/http.py
+++ b/plomtask/http.py
@@ -389,8 +389,7 @@ class TaskHandler(BaseHTTPRequestHandler):
         todo.set_blockers(self.conn, self.form_data.get_all_int('blocker'))
         todo.set_enables(self.conn, self.form_data.get_all_int('enables'))
         todo.set_disables(self.conn, self.form_data.get_all_int('disables'))
-        if len(self.form_data.get_all_str('done')) > 0 != todo.is_done:
-            todo.is_done = len(self.form_data.get_all_str('done')) > 0
+        todo.is_done = len(self.form_data.get_all_str('done')) > 0
         todo.calendarize = len(self.form_data.get_all_str('calendarize')) > 0
         todo.comment = self.form_data.get_str('comment', ignore_strict=True)
         todo.save(self.conn)
diff --git a/templates/todo.html b/templates/todo.html
index 05e5b62..fd16680 100644
--- a/templates/todo.html
+++ b/templates/todo.html
@@ -18,11 +18,13 @@
 </tr>
 <tr>
 <th>done</th>
-<td><input type="checkbox" name="done" {% if todo.is_done %}checked {% endif %} {% if not todo.is_doable %}disabled {% endif %}/><br /></td>
+<td><input type="checkbox" name="done" {% if todo.is_done %}checked {% endif %} {% if not todo.is_doable %}disabled {% endif %}/>
+{% if not todo.is_doable and todo.is_done %}<input type="hidden" name="done" value="1" />{% endif %}
+</td>
 </tr>
 <tr>
 <th>effort</th>
-<td><input type="number" name="effort" step=0.1 size=5 placeholder={{todo.effort_then}} value={{todo.effort}} /><br /></td>
+<td><input type="number" name="effort" step=0.1 size=5 placeholder={{todo.effort_then}} value={{todo.effort}} /></td>
 </tr>
 <tr>
 <th>comment</th>