home · contact · privacy
Fix inability of updating Todo if .is_done but no more doable.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 9 Jun 2024 05:23:52 +0000 (07:23 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 9 Jun 2024 05:23:52 +0000 (07:23 +0200)
plomtask/http.py
plomtask/todos.py

index 44300166f0cc5d91fbdfe0c532dcf01c9d3e87e6..44c710b3b9bd46e04f67a210d6c3e526b0d43724 100644 (file)
@@ -144,7 +144,7 @@ class TaskHandler(BaseHTTPRequestHandler):
         """Show single Day of ?date=."""
         date = self.params.get_str('date', date_in_n_days(0))
         todays_todos = Todo.by_date(self.conn, date)
-        total_effort = 0
+        total_effort = 0.0
         for todo in todays_todos:
             total_effort += todo.performed_effort
         conditions_present = []
@@ -389,7 +389,8 @@ 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'))
-        todo.is_done = len(self.form_data.get_all_str('done')) > 0
+        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.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)
index af45f720ca6e2011fb52bd5af18582a2feca76f1..0125b97809350de3c991d332d80c7adfbaf583ce 100644 (file)
@@ -258,7 +258,7 @@ class Todo(BaseModel[int], ConditionsRelations):
         """Return sum of performed efforts of self and all descendants."""
 
         def walk_tree(node: Todo) -> float:
-            local_effort = 0
+            local_effort = 0.0
             for child in node.children:
                 local_effort += walk_tree(child)
             return node.performed_effort + local_effort