From 6c3fca10aa663422abc48b96b38628dc2771701a Mon Sep 17 00:00:00 2001 From: Christian Heller <c.heller@plomlompom.de> Date: Sun, 9 Jun 2024 07:30:46 +0200 Subject: [PATCH] Simplify and improve previous bugfix. --- plomtask/http.py | 3 +-- templates/todo.html | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) 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> -- 2.30.2