From: Christian Heller
Date: Wed, 15 May 2024 06:32:13 +0000 (+0200)
Subject: Add POSTing of Todo.comment in Day view.
X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/%7B%7Byoutube_prefix%7D%7D%7B%7Bvideo_data.id_%7D%7D?a=commitdiff_plain;h=e06d3b744f88b2976399b0cbe08b526bb7e88907;p=plomtask
Add POSTing of Todo.comment in Day view.
---
diff --git a/plomtask/http.py b/plomtask/http.py
index cf3288a..15f8376 100644
--- a/plomtask/http.py
+++ b/plomtask/http.py
@@ -194,7 +194,7 @@ class TaskHandler(BaseHTTPRequestHandler):
"""Update or insert Day of date and Todos mapped to it."""
date = self.params.get_str('date')
day = Day.by_id(self.conn, date, create=True)
- day.comment = self.form_data.get_str('comment')
+ day.comment = self.form_data.get_str('day_comment')
day.save(self.conn)
new_todos = []
for process_id in self.form_data.get_all_int('new_todo'):
@@ -212,9 +212,12 @@ class TaskHandler(BaseHTTPRequestHandler):
todo.make_missing_children(self.conn)
todo.save(self.conn)
done_ids = self.form_data.get_all_int('done')
- for todo_id in self.form_data.get_all_int('todo_id'):
+ comments = self.form_data.get_all_str('comment')
+ for i, todo_id in enumerate(self.form_data.get_all_int('todo_id')):
todo = Todo.by_id(self.conn, todo_id)
todo.is_done = todo_id in done_ids
+ if len(comments) > 0:
+ todo.comment = comments[i]
todo.save(self.conn)
for condition in todo.enables:
condition.save(self.conn)
diff --git a/templates/day.html b/templates/day.html
index cd683da..b816f35 100644
--- a/templates/day.html
+++ b/templates/day.html
@@ -50,7 +50,7 @@ td.todo_line {
{% if condition in node.todo.enables %}+{% elif condition in node.todo.disables %}!{% endif %}
{% endfor %}
-
+
{% endif %}
@@ -71,7 +71,7 @@ td.todo_line {
{% if path|length > 0 and not path[-1].todo.is_done %}