- todo.adopt_from(existing_todos)
- todo.make_missing_children(self.conn)
- todo.save(self.conn)
- for todo_id in self.form_data.get_all_int('done'):
+ new_todos += [todo]
+ adopted = True
+ while adopted:
+ adopted = False
+ existing_todos = Todo.by_date(self.conn, date)
+ for todo in new_todos:
+ if todo.adopt_from(existing_todos):
+ adopted = True
+ 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'):