adopted = True
todo.make_missing_children(self.conn)
todo.save(self.conn)
- for todo_id in self.form_data.get_all_int('done'):
+ done_ids = self.form_data.get_all_int('done')
+ for todo_id in self.form_data.get_all_int('todo_id'):
todo = Todo.by_id(self.conn, todo_id)
- todo.is_done = True
+ todo.is_done = todo_id in done_ids
todo.save(self.conn)
for condition in todo.enables:
condition.save(self.conn)
{% macro show_node_undone(node, indent) %}
{% if not node.todo.is_done %}
<tr>
+<input type="hidden" name="todo_id" value="{{node.todo.id_}}" />
{% for condition in conditions_present %}
<td class="cond_line_{{loop.index0 % 3}} {% if not condition.is_active %}min_width{% endif %}">{% if condition in node.todo.conditions %}{% if not condition.is_active %}O{% endif %}{% endif %}</td>
{% endfor %}
<td class="todo_line">-></td>
-<td class="todo_line"><input name="done" type="checkbox" {% if node.todo.is_done %}checked disabled{% endif %} {% if not node.todo.is_doable %}disabled{% endif %}/></td>
+<td class="todo_line"><input name="done" type="checkbox" value="{{node.todo.id_}}" {% if node.todo.is_done %}checked disabled{% endif %} {% if not node.todo.is_doable %}disabled{% endif %}/></td>
<td class="todo_line">
{% for i in range(indent) %} {% endfor %} +
{% if node.seen %}({% endif %}<a href="todo?id={{node.todo.id_}}">{{node.todo.process.title.newest|e}}</a>{% if node.seen %}){% endif %}
self.assertEqual(todo2.children, [todo1])
self.assertEqual(todo2.parents, [])
+ def test_do_POST_day_todo_doneness(self) -> None:
+ """Test multiple Todos can be posted to Day view."""
+ form_data = self.post_process()
+ form_data = {'comment': '', 'new_todo': [1]}
+ self.check_post(form_data, '/day?date=2024-01-01', 302)
+ todo = Todo.by_date(self.db_conn, '2024-01-01')[0]
+ form_data = {'comment': '', 'todo_id': [1]}
+ self.check_post(form_data, '/day?date=2024-01-01', 302)
+ self.assertEqual(todo.is_done, False)
+ form_data = {'comment': '', 'todo_id': [1], 'done': [1]}
+ self.check_post(form_data, '/day?date=2024-01-01', 302)
+ self.assertEqual(todo.is_done, True)
+
def test_do_GET_todo(self) -> None:
"""Test GET /todo response codes."""
self.post_process()