home · contact · privacy
Improve accounting scripts.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 5 Feb 2024 07:12:17 +0000 (08:12 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 5 Feb 2024 07:12:17 +0000 (08:12 +0100)
ledger.py
todo.py
todo_templates/base.html
todo_templates/do_todos.html
todo_templates/task.html
todo_templates/tasks.html
todo_templates/todo.html

index 656a26e95656a6d83e6c23a7814be7f648728076..958852aa56b0e747c1c2ad36f78f0d054f255310 100755 (executable)
--- a/ledger.py
+++ b/ledger.py
@@ -531,14 +531,19 @@ class LedgerHandler(PlomHandler):
             edit_mode = postvars['edit_mode'][0]
             validate = submit_button in {'update', 'add', 'copy', 'check'}
             starts_at = '?' if index == -1 else db.bookings[index].starts_at
             edit_mode = postvars['edit_mode'][0]
             validate = submit_button in {'update', 'add', 'copy', 'check'}
             starts_at = '?' if index == -1 else db.bookings[index].starts_at
+            delete = False
             if 'textarea' == edit_mode:
                 lines = [LedgerTextLine(line) for line in postvars['booking'][0].rstrip().split('\n')]
             if 'textarea' == edit_mode:
                 lines = [LedgerTextLine(line) for line in postvars['booking'][0].rstrip().split('\n')]
-                booking = Booking(lines, starts_at, validate=validate)
+                if len(lines) == 1 and lines[0].text_line == 'delete':
+                    delete = True
+                else:
+                    booking = Booking(lines, starts_at, validate=validate)
             else:
                 booking = Booking.from_postvars(postvars, starts_at, validate)
             if submit_button in {'update', 'add'}:
                 if submit_button == 'update':
             else:
                 booking = Booking.from_postvars(postvars, starts_at, validate)
             if submit_button in {'update', 'add'}:
                 if submit_button == 'update':
-                    if 'textarea' == edit_mode and 'delete' == ''.join([l.text_line for l in lines]).strip():
+                    # if 'textarea' == edit_mode and 'delete' == ''.join([l.text_line for l in lines]).strip():
+                    if 'textarea' == edit_mode and delete:
                        del db.bookings[index]
                     # if not creating new Booking, and date unchanged, keep it in place 
                     elif booking.date == db.bookings[index].date:
                        del db.bookings[index]
                     # if not creating new Booking, and date unchanged, keep it in place 
                     elif booking.date == db.bookings[index].date:
diff --git a/todo.py b/todo.py
index 11b0149028966effd5f551d1fbc0f36819838faf..6c84ee0dbe8e5d7b05fe00d625ef3342b972d97a 100644 (file)
--- a/todo.py
+++ b/todo.py
@@ -87,7 +87,7 @@ class Task:
         self.comment = comment
 
         self.visible = True
         self.comment = comment
 
         self.visible = True
-        self.parents = [] 
+        self.dependers = [] 
 
     @classmethod
     def from_dict(cls, db, d, id_):
 
     @classmethod
     def from_dict(cls, db, d, id_):
@@ -119,6 +119,15 @@ class Task:
             subtasks += [self.db.tasks[id_]]
         return subtasks
 
             subtasks += [self.db.tasks[id_]]
         return subtasks
 
+    @property
+    def subtask_depth(self):
+        def count_depth(task):
+            sub_count = 1
+            for subtask in task.subtasks:
+                sub_count += count_depth(subtask)
+            return sub_count
+        return count_depth(self) 
+
     def subtask_loop_checker(self):
         def f(subtask_ids_now):
             loop_msg = "can't set subtask, would create loop"
     def subtask_loop_checker(self):
         def f(subtask_ids_now):
             loop_msg = "can't set subtask, would create loop"
@@ -185,6 +194,7 @@ class Day:
         s = 0
         for todo in [todo for todo in self.linked_todos.values()
                      if self.date in todo.efforts.keys()]:
         s = 0
         for todo in [todo for todo in self.linked_todos.values()
                      if self.date in todo.efforts.keys()]:
+                     # and not todo.children]:
             day_effort = todo.efforts[self.date]
             if todo.done:
                 s += day_effort if day_effort else todo.task.default_effort.at(self.date)
             day_effort = todo.efforts[self.date]
             if todo.done:
                 s += day_effort if day_effort else todo.task.default_effort.at(self.date)
@@ -208,18 +218,18 @@ class Todo:
                  day_tags=None,
                  importance=1.0,
                  efforts=None,
                  day_tags=None,
                  importance=1.0,
                  efforts=None,
-                 child_ids=None):
+                 dep_ids=None):
         self.id_ = id_
         self.db = db 
         self.task = task 
         self._done = done
         self.id_ = id_
         self.db = db 
         self.task = task 
         self._done = done
-        self._efforts = efforts if efforts else {}
+        self.efforts = efforts if efforts else {}
         self.comment = comment
         self.day_tags = day_tags if day_tags else set()
         self.importance = importance
         self.comment = comment
         self.day_tags = day_tags if day_tags else set()
         self.importance = importance
-        self.child_ids = child_ids if child_ids else [] 
+        self.dep_ids = dep_ids if dep_ids else [] 
 
 
-        self.parents = [] 
+        self.dependers = [] 
 
     @classmethod
     def from_dict(cls, db, d, id_):
 
     @classmethod
     def from_dict(cls, db, d, id_):
@@ -232,7 +242,7 @@ class Todo:
                 set(d['day_tags']),
                 d['importance'],
                 d['efforts'],
                 set(d['day_tags']),
                 d['importance'],
                 d['efforts'],
-                d['children'])
+                d['deps'])
         return todo
 
     def to_dict(self):
         return todo
 
     def to_dict(self):
@@ -243,11 +253,7 @@ class Todo:
                 'day_tags': list(self.day_tags),
                 'importance': self.importance,
                 'efforts': self.efforts,
                 'day_tags': list(self.day_tags),
                 'importance': self.importance,
                 'efforts': self.efforts,
-                'children': self.child_ids}
-
-    @property
-    def parent(self):
-        return self.parents[0] if len(self.parents) > 0 else None 
+                'deps': self.dep_ids}
 
     @property
     def title(self):
 
     @property
     def title(self):
@@ -258,12 +264,12 @@ class Todo:
         return f'{self.earliest_date}:{self.title}'
 
     @property
         return f'{self.earliest_date}:{self.title}'
 
     @property
-    def children(self):
-        return [self.db.todos[id_] for id_ in self.child_ids]
+    def deps(self):
+        return [self.db.todos[id_] for id_ in self.dep_ids]
 
 
-    @children.setter
-    def children(self, children):
-        self.child_ids = [child.id_ for child in children]
+    @deps.setter
+    def deps(self, deps):
+        self.dep_ids = [dep.id_ for dep in deps]
 
     @property
     def default_effort(self):
 
     @property
     def default_effort(self):
@@ -271,45 +277,45 @@ class Todo:
 
     @property
     def done(self):
 
     @property
     def done(self):
-        if len(self.children) > 0:
-            for child in self.children:
-                if not child.done:
-                    return False
-            return True
-        else:
-            return self._done
+        return self.deps_done and self._done
 
     @done.setter
     def done(self, doneness):
         self._done = doneness
 
     @property
 
     @done.setter
     def done(self, doneness):
         self._done = doneness
 
     @property
-    def efforts(self):
-        if self.children:
-            efforts = {} 
-            for date in self._efforts.keys():
-                efforts[date] = None
-            for child in self.children:
-                to_add = None 
-                for date, effort in child.efforts.items():
-                    if not date in efforts.keys():
-                        efforts[date] = None 
-                    if effort is not None:
-                        to_add = effort / len(child.parents)
-                    elif child.done:
-                        to_add = child.task.default_effort.at(date) / len(child.parents)
-                if to_add is not None:
-                    if efforts[date] is not None:
-                        efforts[date] += to_add
-                    else:
-                        efforts[date] = to_add
-            return efforts
+    def deps_done(self):
+        if len(self.deps) > 0:
+            for dep in self.deps:
+                if not dep.done:
+                    return False
+        return True
+
+    @property
+    def dep_efforts(self):
+        dep_efforts = 0
+        if self.deps:
+            for dep in self.deps: 
+                dep_efforts += dep.all_days_effort
+                dep_efforts += dep.dep_efforts
+        return dep_efforts
+
+    def depender_path(self, dep):
+        if self.dependers:
+            return f'Y{depender.depender_path()}:{self.title}Y'
         else:
         else:
-            return self._efforts
+            return f'X{self.title}X'
 
 
-    @efforts.setter
-    def efforts(self, efforts_dict):
-        self._efforts = efforts_dict
+    @property
+    def depender_paths(self):
+        paths = []
+        for depender in self.dependers:
+            if len(depender.depender_paths) == 0:
+                 paths += [[depender]]
+            else:
+                for path in depender.depender_paths:
+                    paths += [path + [depender]] 
+        return paths
 
     @property
     def all_days_effort(self):
 
     @property
     def all_days_effort(self):
@@ -392,16 +398,16 @@ class TodoDB(PlomDB):
             for tag in t.tags.now:
                 self.t_tags.add(tag)
         for task in self.tasks.values():
             for tag in t.tags.now:
                 self.t_tags.add(tag)
         for task in self.tasks.values():
-            for child in task.subtasks:
-                child.parents += [task]
+            for dep in task.subtasks:
+                dep.dependers += [task]
 
         for id_, todo_dict in d['todos'].items():
             todo = self.add_todo(todo_dict, id_, link_into_day=False)
             for tag in todo.day_tags:
                 self.t_tags.add(tag)
         for todo in self.todos.values():
 
         for id_, todo_dict in d['todos'].items():
             todo = self.add_todo(todo_dict, id_, link_into_day=False)
             for tag in todo.day_tags:
                 self.t_tags.add(tag)
         for todo in self.todos.values():
-            for child in todo.children:
-                child.parents += [todo]
+            for dep in todo.deps:
+                dep.dependers += [todo]
 
         for date, day_dict in d['days'].items():
             self.add_day(dict_source=day_dict, date=date)
 
         for date, day_dict in d['days'].items():
             self.add_day(dict_source=day_dict, date=date)
@@ -409,8 +415,6 @@ class TodoDB(PlomDB):
             for date in todo.efforts.keys():
                 if not date in self.days.keys():
                     self.add_day(date)
             for date in todo.efforts.keys():
                 if not date in self.days.keys():
                     self.add_day(date)
-                # if not todo in self.days[date].linked_todos_as_list:
-                #    self.days[date].linked_todos_as_list += [todo]
                 self.days[date].linked_todos_as_list += [todo]
 
         self.set_visibilities()
                 self.days[date].linked_todos_as_list += [todo]
 
         self.set_visibilities()
@@ -464,27 +468,28 @@ class TodoDB(PlomDB):
         task.comment = comment 
         return task
 
         task.comment = comment 
         return task
 
-    def add_todo(self, todo_dict=None, id_=None, task=None, efforts=None, link_into_day=True):
+    def add_todo(self, todo_dict=None, id_=None, task=None, efforts=None, link_into_day=True, adopt_if_possible=True):
         id_ = id_ if id_ else str(uuid4())
         if todo_dict:
             todo = Todo.from_dict(self, todo_dict, id_)
         elif task and efforts:
             todo = Todo(self, id_, task, efforts=efforts)
         id_ = id_ if id_ else str(uuid4())
         if todo_dict:
             todo = Todo.from_dict(self, todo_dict, id_)
         elif task and efforts:
             todo = Todo(self, id_, task, efforts=efforts)
-            children = []
-            for child_task in task.subtasks:
-                # if Todo expects chuldren, adopt any compatibles found in DB.selected_date
-                # before creating new child Todos
-                child_todo = None
-                if list(efforts.keys())[0] == self.selected_date:
+            deps = []
+            for dep_task in task.subtasks:
+                # if Todo expects dependencies, adopt any compatibles found in DB.selected_date
+                # before creating new depended Todos
+                dep_todo = None
+                if adopt_if_possible and list(efforts.keys())[0] == self.selected_date:
                     adoptable_todos = [t for t in self.selected_day.linked_todos_as_list
                     adoptable_todos = [t for t in self.selected_day.linked_todos_as_list
-                                       if t.task.id_ == child_task.id_]
+                                       if t.task.id_ == dep_task.id_]
                     if len(adoptable_todos) > 0:
                     if len(adoptable_todos) > 0:
-                        child_todo = adoptable_todos[0]
-                if not child_todo:
-                    child_todo = self.add_todo(task=child_task,
-                                               efforts=efforts, link_into_day=link_into_day)
-                children += [child_todo]
-            todo.child_ids = [child.id_ for child in children]
+                        dep_todo = adoptable_todos[0]
+                if not dep_todo:
+                    dep_todo = self.add_todo(task=dep_task, efforts=efforts,
+                                               link_into_day=link_into_day,
+                                               adopt_if_possible=adopt_if_possible)
+                deps += [dep_todo]
+            todo.dep_ids = [dep.id_ for dep in deps]
         self.todos[id_] = todo 
         if link_into_day:
             self.selected_day.linked_todos_as_list += [todo] 
         self.todos[id_] = todo 
         if link_into_day:
             self.selected_day.linked_todos_as_list += [todo] 
@@ -501,11 +506,11 @@ class TodoDB(PlomDB):
         todo = self._update_todo_shared(id_, done, comment, importance)
         todo.efforts[date] = effort 
 
         todo = self._update_todo_shared(id_, done, comment, importance)
         todo.efforts[date] = effort 
 
-    def update_todo(self, id_, efforts, done, comment, tags, importance, children):
+    def update_todo(self, id_, efforts, done, comment, tags, importance, deps):
         todo = self._update_todo_shared(id_, done, comment, importance)
         todo = self._update_todo_shared(id_, done, comment, importance)
-        if len(efforts) == 0 and not todo.children:
+        if len(efforts) == 0 and not todo.deps:
             raise PlomException('todo must have at least one effort!')
             raise PlomException('todo must have at least one effort!')
-        todo.children = children
+        todo.deps = deps 
         todo.efforts = efforts 
         for date in todo.efforts.keys():
             if not date in self.days.keys():
         todo.efforts = efforts 
         for date in todo.efforts.keys():
             if not date in self.days.keys():
@@ -521,8 +526,8 @@ class TodoDB(PlomDB):
             dates_to_delete += [date]
         for date in dates_to_delete:
             self.delete_effort(todo, date, force=True)
             dates_to_delete += [date]
         for date in dates_to_delete:
             self.delete_effort(todo, date, force=True)
-        for parent in todo.parents:
-            parent.child_ids.remove(todo.id_)
+        for depender in todo.dependers:
+            depender.dep_ids.remove(todo.id_)
         del self.todos[id_]
 
     def delete_task(self, id_):
         del self.todos[id_]
 
     def delete_task(self, id_):
@@ -563,9 +568,16 @@ class TodoDB(PlomDB):
 
     def show_do_todos(self, sort_order=None):
         prev_date_str, next_date_str = self.neighbor_dates()
 
     def show_do_todos(self, sort_order=None):
         prev_date_str, next_date_str = self.neighbor_dates()
+        adoptable_past_todos = []
+        for todo in self.todos.values():
+            if todo.done\
+                    or (not todo.visible)\
+                    or todo.earliest_date >= self.selected_date:
+                continue
+            adoptable_past_todos += [todo] 
         todos = [t for t in self.selected_day.linked_todos_as_list
         todos = [t for t in self.selected_day.linked_todos_as_list
-                 if t.visible
-                 and not t.children]
+                 if t.visible]
+                 # and not t.deps]
         if sort_order == 'title':
             todos.sort(key=lambda t: t.task.title.then)
         elif sort_order == 'done':
         if sort_order == 'title':
             todos.sort(key=lambda t: t.task.title.then)
         elif sort_order == 'done':
@@ -580,12 +592,14 @@ class TodoDB(PlomDB):
                 filter_and=self.tag_filter_and,
                 filter_not=self.tag_filter_not,
                 prev_date=prev_date_str,
                 filter_and=self.tag_filter_and,
                 filter_not=self.tag_filter_not,
                 prev_date=prev_date_str,
+                adoptable_past_todos=adoptable_past_todos,
                 next_date=next_date_str,
                 next_date=next_date_str,
+                all_tasks=[t for t in self.tasks.values()],
                 todos=todos,
                 sort=sort_order,
                 hide_done=self.hide_done)
 
                 todos=todos,
                 sort=sort_order,
                 hide_done=self.hide_done)
 
-    def show_todo(self, id_, search, start_date, end_date):
+    def show_todo(self, id_, start_date, end_date):
         todo = self.todos[id_]
         filtered_tasks = [t for t in self.tasks.values()
                           if t != todo.task] 
         todo = self.todos[id_]
         filtered_tasks = [t for t in self.tasks.values()
                           if t != todo.task] 
@@ -614,7 +628,7 @@ class TodoDB(PlomDB):
                 todo=todo,
                 filtered_todos=date_filtered_todos,
                 filtered_tasks=filtered_tasks,
                 todo=todo,
                 filtered_todos=date_filtered_todos,
                 filtered_tasks=filtered_tasks,
-                child_todos=todo.children,
+                dep_todos=todo.deps,
                 start_date=start_date,
                 end_date=end_date)
 
                 start_date=start_date,
                 end_date=end_date)
 
@@ -631,67 +645,73 @@ class TodoDB(PlomDB):
                 filtered_tasks=filtered_tasks,
                 task=task)
 
                 filtered_tasks=filtered_tasks,
                 task=task)
 
-    def show_tasks(self, expand_uuid):
-        expanded_tasks = {}
-        if expand_uuid:
-            for uuid in self.tasks[expand_uuid].subtask_ids.now:
-                expanded_tasks[uuid] = self.tasks[uuid]
-        return j2env.get_template('tasks.html').render(
-                db=self,
-                filter_and=self.tag_filter_and,
-                filter_not=self.tag_filter_not,
-                expand_uuid=expand_uuid,
-                expanded_tasks=expanded_tasks)
-
-    def show_pick_tasks(self, search, hide_chosen_tasks, sort_order=None):
-        prev_date_str, next_date_str = self.neighbor_dates()
-
-        chosen_todos = self.selected_day.linked_todos_as_list
-
-        relevant_todos = []
-        for todo in self.todos.values():
-            if todo.done\
-                    or (not todo.visible)\
-                    or (not todo.matches(search))\
-                    or todo.earliest_date >= self.selected_date:
-                continue
-            relevant_todos += [todo] 
-
-        filtered_tasks = []
-        chosen_tasks = [todo.task for todo in self.selected_day.linked_todos_as_list]
-        for uuid, task in self.tasks.items():
-            if (not task.visible)\
-                    or (not task.matches(search))\
-                    or (hide_chosen_tasks and task in chosen_tasks):
-                continue
+    def show_tasks(self, search, sort_order=None):
+        filtered_tasks = [] 
+        for task in [t for t in self.tasks.values() if (not search) or t.matches(search)]:
             filtered_tasks += [task]
             filtered_tasks += [task]
-
         if sort_order == 'title':
         if sort_order == 'title':
-            chosen_todos.sort(key=lambda t: t.title)
-            relevant_todos.sort(key=lambda t: t.dated_title)
-            tasks.sort(key=lambda t: t.title.then)
-        elif sort_order == 'effort':
-            chosen_todos.sort(key=lambda t:
-                              t.day_effort if t.day_effort else (t.default_effort if t.done else 0),
-                              reverse=True)
-            relevant_todos.sort(key=lambda t: t.all_days_effort, reverse=True)
-            filtered_tasks.sort(key=lambda t: t.default_effort.then, reverse=True)
-
-        return j2env.get_template('pick_tasks.html').render(
+            filtered_tasks.sort(key=lambda t: t.title.now)
+        elif sort_order == 'default_effort':
+            filtered_tasks.sort(key=lambda t: t.default_effort.now, reverse=True)
+        elif sort_order == 'depth':
+            filtered_tasks.sort(key=lambda t: t.subtask_depth, reverse=True)
+        return j2env.get_template('tasks.html').render(
                 sort=sort_order,
                 sort=sort_order,
+                tasks=filtered_tasks,
                 tags=self.t_tags,
                 tags=self.t_tags,
-                chosen_todos=chosen_todos,
                 filter_and=self.tag_filter_and,
                 filter_not=self.tag_filter_not,
                 filter_and=self.tag_filter_and,
                 filter_not=self.tag_filter_not,
-                day=self.selected_day,
-                prev_date=prev_date_str,
-                next_date=next_date_str,
-                all_tasks=[t for t in self.tasks.values()],
-                filtered_tasks=filtered_tasks,
-                hide_chosen_tasks=hide_chosen_tasks,
-                relevant_todos=relevant_todos,
                 search=search)
 
                 search=search)
 
+    # def show_pick_tasks(self, search, hide_chosen_tasks, sort_order=None):
+    #     prev_date_str, next_date_str = self.neighbor_dates()
+
+    #     chosen_todos = self.selected_day.linked_todos_as_list
+
+    #     relevant_todos = []
+    #     for todo in self.todos.values():
+    #         if todo.done\
+    #                 or (not todo.visible)\
+    #                 or (not todo.matches(search))\
+    #                 or todo.earliest_date >= self.selected_date:
+    #             continue
+    #         relevant_todos += [todo] 
+
+    #     filtered_tasks = []
+    #     chosen_tasks = [todo.task for todo in self.selected_day.linked_todos_as_list]
+    #     for uuid, task in self.tasks.items():
+    #         if (not task.visible)\
+    #                 or (not task.matches(search))\
+    #                 or (hide_chosen_tasks and task in chosen_tasks):
+    #             continue
+    #         filtered_tasks += [task]
+
+    #     if sort_order == 'title':
+    #         chosen_todos.sort(key=lambda t: t.title)
+    #         relevant_todos.sort(key=lambda t: t.dated_title)
+    #         tasks.sort(key=lambda t: t.title.then)
+    #     elif sort_order == 'effort':
+    #         chosen_todos.sort(key=lambda t:
+    #                           t.day_effort if t.day_effort else (t.default_effort if t.done else 0),
+    #                           reverse=True)
+    #         relevant_todos.sort(key=lambda t: t.all_days_effort, reverse=True)
+    #         filtered_tasks.sort(key=lambda t: t.default_effort.then, reverse=True)
+
+    #     return j2env.get_template('pick_tasks.html').render(
+    #             sort=sort_order,
+    #             tags=self.t_tags,
+    #             chosen_todos=chosen_todos,
+    #             filter_and=self.tag_filter_and,
+    #             filter_not=self.tag_filter_not,
+    #             day=self.selected_day,
+    #             prev_date=prev_date_str,
+    #             next_date=next_date_str,
+    #             all_tasks=[t for t in self.tasks.values()],
+    #             filtered_tasks=filtered_tasks,
+    #             hide_chosen_tasks=hide_chosen_tasks,
+    #             relevant_todos=relevant_todos,
+    #             search=search)
+
     # helpers
 
     def set_visibilities(self):
     # helpers
 
     def set_visibilities(self):
@@ -842,14 +862,15 @@ class TodoHandler(PlomHandler):
         if site in {'calendar', 'todo'}:
             redir_params += [('end', postvars.get('end', '-'))]
             redir_params += [('start', postvars.get('start', '-'))]
         if site in {'calendar', 'todo'}:
             redir_params += [('end', postvars.get('end', '-'))]
             redir_params += [('start', postvars.get('start', '-'))]
-        if site in {'todo', 'pick_tasks'}:
-            redir_params += [('search', postvars.get('search', ''))]
-            redir_params += [('search', postvars.get('search', ''))]
-            redir_params += [('search', postvars.get('search', ''))]
+        # if site in {'tasks', 'pick_tasks'}:
+        #     redir_params += [('search', postvars.get('search', ''))]
         if postvars.has('filter'): 
             postvars.set('return_to', '')
         
         if postvars.has('filter'): 
             postvars.set('return_to', '')
         
-        if 'todo' == site:
+        if 'tasks' == site:
+            redir_params += [('search', postvars.get('search', ''))]
+
+        elif 'todo' == site:
             todo_id = postvars.get('todo_id')
             redir_params += [('id', todo_id)]
             old_todo = db.todos[todo_id] if todo_id in db.todos.keys() else None
             todo_id = postvars.get('todo_id')
             redir_params += [('id', todo_id)]
             old_todo = db.todos[todo_id] if todo_id in db.todos.keys() else None
@@ -864,7 +885,7 @@ class TodoHandler(PlomHandler):
                     raise PlomException(f'bad date string')
                 latest_date = date
                 efforts[date] = None
                     raise PlomException(f'bad date string')
                 latest_date = date
                 efforts[date] = None
-                if not (old_todo and old_todo.children):
+                if not (old_todo and old_todo.deps):
                     efforts[date] = postvars.get_at_index('effort', i, on_empty=None,
                                                           float_if_possible=True)
             if postvars.has('delete'): 
                     efforts[date] = postvars.get_at_index('effort', i, on_empty=None,
                                                           float_if_possible=True)
             if postvars.has('delete'): 
@@ -881,21 +902,21 @@ class TodoHandler(PlomHandler):
                     for date in postvars.get_all('delete_effort'):
                         db.delete_effort(old_todo, date)
                         del efforts[date]
                     for date in postvars.get_all('delete_effort'):
                         db.delete_effort(old_todo, date)
                         del efforts[date]
-                children = [db.todos[id_] for id_ in postvars.get_all('adopt_child', [])
-                            if id_ in db.todos.keys()] 
-                for child in children:
-                    if not todo_id in [t.id_ for t in child.parents]:
-                        child.parents += [db.todos[todo_id]]
-                tasks_to_birth = [db.tasks[id_] for id_ in postvars.get_all('birth_child', [])]
+                deps = [db.todos[id_] for id_ in postvars.get_all('adopt_dep', [])
+                        if id_ in db.todos.keys()] 
+                for dep in deps:
+                    if not todo_id in [t.id_ for t in dep.dependers]:
+                        dep.dependers += [db.todos[todo_id]]
+                tasks_to_birth = [db.tasks[id_] for id_ in postvars.get_all('birth_dep', [])]
                 for task in tasks_to_birth:
                 for task in tasks_to_birth:
-                    children += [db.add_todo(task=task, efforts={latest_date: None})]
+                    deps += [db.add_todo(task=task, efforts={latest_date: None})]
                 db.update_todo(id_=todo_id,
                                efforts=efforts,
                                done=postvars.has('done'),
                                comment=postvars.get('comment', ''),
                                tags=postvars.get_all('tag', []),
                                importance=float(postvars.get('importance')),
                 db.update_todo(id_=todo_id,
                                efforts=efforts,
                                done=postvars.has('done'),
                                comment=postvars.get('comment', ''),
                                tags=postvars.get_all('tag', []),
                                importance=float(postvars.get('importance')),
-                               children=children)
+                               deps=deps)
 
         elif 'task' == site:
             task_id = postvars.get('task_id')
 
         elif 'task' == site:
             task_id = postvars.get('task_id')
@@ -920,30 +941,30 @@ class TodoHandler(PlomHandler):
                     db.add_todo(task=task, efforts={postvars.get('selected_date'): None})
             redir_params += [('id', task_id)]
 
                     db.add_todo(task=task, efforts={postvars.get('selected_date'): None})
             redir_params += [('id', task_id)]
 
-        elif 'pick_tasks' == site:
-            redir_params += [('hide_chosen_tasks', int(postvars.has('hide_chosen_tasks')))]
-            if postvars.has('update'):
-                db.selected_date = postvars.get('date')
-                todos_to_shrink = []
-                todos_to_delete = []
-                for todo in db.selected_day.linked_todos_as_list:
-                    if todo.visible and not todo.id_ in postvars.get_all('chosen_todo', []):
-                        if len(todo.comment) > 0\
-                                or len(todo.day_tags) > 0\
-                                or not todo.is_effort_removable(db.selected_date):
-                            raise PlomException('will not remove effort of preserve-worthy values')
-                        if len(todo.efforts) > 1:
-                            todos_to_shrink += [todo]
-                        else:
-                            todos_to_delete += [todo]
-                for todo in todos_to_shrink:
-                    db.delete_effort(todo, db.selected_date)
-                for todo in todos_to_delete:
-                    db.delete_todo(todo.id_)
-                for id_ in postvars.get_all('choose_task', []):
-                    db.add_todo(task=db.tasks[id_], efforts={db.selected_date: None})
-                for id_ in postvars.get_all('choose_todo', []):
-                    db.todos[id_].efforts[db.selected_date] = None
+        elif 'pick_tasks' == site:
+            redir_params += [('hide_chosen_tasks', int(postvars.has('hide_chosen_tasks')))]
+            if postvars.has('update'):
+                db.selected_date = postvars.get('date')
+                todos_to_shrink = []
+                todos_to_delete = []
+                for todo in db.selected_day.linked_todos_as_list:
+                    if todo.visible and not todo.id_ in postvars.get_all('chosen_todo', []):
+                        if len(todo.comment) > 0\
+                                or len(todo.day_tags) > 0\
+                                or not todo.is_effort_removable(db.selected_date):
+                            raise PlomException('will not remove effort of preserve-worthy values')
+                        if len(todo.efforts) > 1:
+                            todos_to_shrink += [todo]
+                        else:
+                            todos_to_delete += [todo]
+                for todo in todos_to_shrink:
+                    db.delete_effort(todo, db.selected_date)
+                for todo in todos_to_delete:
+                    db.delete_todo(todo.id_)
+                for id_ in postvars.get_all('choose_task', []):
+                    db.add_todo(task=db.tasks[id_], efforts={db.selected_date: None})
+                for id_ in postvars.get_all('choose_todo', []):
+                    db.todos[id_].efforts[db.selected_date] = None
 
         elif 'do_todos' == site:
             redir_params += [('hide_done', int(postvars.has('hide_done')))]
 
         elif 'do_todos' == site:
             redir_params += [('hide_done', int(postvars.has('hide_done')))]
@@ -951,6 +972,14 @@ class TodoHandler(PlomHandler):
                 db.selected_date = postvars.get('date') 
                 redir_params += [('date', db.selected_date)]
                 db.selected_day.comment = postvars.get('day_comment', '') 
                 db.selected_date = postvars.get('date') 
                 redir_params += [('date', db.selected_date)]
                 db.selected_day.comment = postvars.get('day_comment', '') 
+                task_id = postvars.get('choose_task', None)
+                if task_id:
+                    if task_id not in db.tasks.keys():
+                        raise PlomException('illegal task ID entered')
+                    db.add_todo(task=db.tasks[task_id], efforts={db.selected_date: None},
+                                adopt_if_possible=(not postvars.has('dont_adopt')))
+                for id_ in postvars.get_all('choose_todo', []):
+                    db.todos[id_].efforts[db.selected_date] = None
                 for i, todo_id in enumerate(postvars.get_all('todo_id', [])):
                     old_todo = db.todos[todo_id]
                     done = todo_id in postvars.get_all('done', [])
                 for i, todo_id in enumerate(postvars.get_all('todo_id', [])):
                     old_todo = db.todos[todo_id]
                     done = todo_id in postvars.get_all('done', [])
@@ -998,9 +1027,9 @@ class TodoHandler(PlomHandler):
         selected_date = tag_filter_and = tag_filter_not = None
         hide_unchosen = hide_done = False
         return_to = params.get('return_to', '')
         selected_date = tag_filter_and = tag_filter_not = None
         hide_unchosen = hide_done = False
         return_to = params.get('return_to', '')
-        if site in {'do_todos', 'pick_tasks', 'calendar', 'task'}:
+        if site in {'do_todos', 'calendar', 'task'}:
             selected_date = params.get_cookied('date')
             selected_date = params.get_cookied('date')
-        if site in {'do_todos', 'pick_tasks'}:
+        if site in {'do_todos', 'tasks'}:
             tag_filter_and = params.get_cookied_chain('and_tag', prefix=site)
             tag_filter_not = params.get_cookied_chain('not_tag', prefix=site)
         if 'do_todos' == site:
             tag_filter_and = params.get_cookied_chain('and_tag', prefix=site)
             tag_filter_not = params.get_cookied_chain('not_tag', prefix=site)
         if 'do_todos' == site:
@@ -1008,17 +1037,15 @@ class TodoHandler(PlomHandler):
         db = TodoDB(selected_date, tag_filter_and, tag_filter_not, hide_unchosen, hide_done)
         if site in {'todo', 'task'}:
             id_ = params.get('id')
         db = TodoDB(selected_date, tag_filter_and, tag_filter_not, hide_unchosen, hide_done)
         if site in {'todo', 'task'}:
             id_ = params.get('id')
-        if site in {'todo', 'pick_tasks'}:
-            search = params.get('search', '')
-        if site in {'do_todos', 'pick_tasks'}:
+        if site in {'do_todos', 'tasks'}:
             sort_order = params.get_cookied('sort', prefix=site)
         if site in {'', 'calendar', 'todo'}:
             start_date = params.get_cookied('start', prefix=site)
             end_date = params.get_cookied('end', prefix=site)
         if 'reset_cookie' == site:
             cookie_db = {  # sensible defaults
             sort_order = params.get_cookied('sort', prefix=site)
         if site in {'', 'calendar', 'todo'}:
             start_date = params.get_cookied('start', prefix=site)
             end_date = params.get_cookied('end', prefix=site)
         if 'reset_cookie' == site:
             cookie_db = {  # sensible defaults
-                params.cookie_key_from_params_key('pick_tasks', 'and_tag'): ['default'],
-                params.cookie_key_from_params_key('pick_tasks', 'not_tag'): ['ignore'],
+                params.cookie_key_from_params_key('pick_tasks', 'and_tag'): ['default'],
+                params.cookie_key_from_params_key('pick_tasks', 'not_tag'): ['ignore'],
                 params.cookie_key_from_params_key('todo', 'and_tag'): ['default'],
                 params.cookie_key_from_params_key('todo', 'not_tag'): ['ignore'],
                 params.cookie_key_from_params_key('todo', 'start'): 'yesterday',
                 params.cookie_key_from_params_key('todo', 'and_tag'): ['default'],
                 params.cookie_key_from_params_key('todo', 'not_tag'): ['ignore'],
                 params.cookie_key_from_params_key('todo', 'start'): 'yesterday',
@@ -1026,16 +1053,16 @@ class TodoHandler(PlomHandler):
             page = db.show_message('cookie unset!')
         elif 'do_todos' == site:
             page = db.show_do_todos(sort_order)
             page = db.show_message('cookie unset!')
         elif 'do_todos' == site:
             page = db.show_do_todos(sort_order)
-        elif 'pick_tasks' == site:
-            hide_chosen_tasks = params.get('hide_chosen_tasks', False)
-            page = db.show_pick_tasks(search, hide_chosen_tasks, sort_order)
+        elif 'pick_tasks' == site:
+            hide_chosen_tasks = params.get('hide_chosen_tasks', False)
+            page = db.show_pick_tasks(search, hide_chosen_tasks, sort_order)
         elif site == 'todo':
         elif site == 'todo':
-            page = db.show_todo(id_, search, start_date, end_date)
+            page = db.show_todo(id_, start_date, end_date)
         elif 'task' == site:
             page = db.show_task(id_)
         elif 'tasks' == site:
         elif 'task' == site:
             page = db.show_task(id_)
         elif 'tasks' == site:
-            expand_uuid = params.get('expand_uuid')
-            page = db.show_tasks(expand_uuid)
+            search = params.get('search', '')
+            page = db.show_tasks(search, sort_order)
         elif 'add_task' == site:
             page = db.show_task(None)
         else:  # 'calendar' == site
         elif 'add_task' == site:
             page = db.show_task(None)
         else:  # 'calendar' == site
index 1084e4ffe8240479c8dfb14bfc73909058a3d5ac..a2d05dae44fe04b362e7cea400df571372795336 100644 (file)
@@ -21,8 +21,7 @@ div.delete { float: right; }
 {% endblock %}
 </style>
 <body>
 {% endblock %}
 </style>
 <body>
-tasks: <a href="tasks">list</a> <a href="add_task">add</a> | day:
-<a href="pick_tasks">pick tasks</a>
+tasks: <a href="tasks">review</a> <a href="add_task">add</a> | day:
 <a href="do_todos">do todos</a>
 | <a href="calendar">calendar</a>
 | <a href="reset_cookie">reset cookie</a>
 <a href="do_todos">do todos</a>
 | <a href="calendar">calendar</a>
 | <a href="reset_cookie">reset cookie</a>
index fd6feb2ec392aebc199a6bd4da0800f864331a01..25211f0f0c0fbbde07334657b6f567f843f7e876 100644 (file)
@@ -5,6 +5,22 @@ td.number, td.checkbox { text-align: center; }
 td { vertical-align: middle; }
 td button { padding: 0em; }
 th.centered { text-align: center; }
 td { vertical-align: middle; }
 td button { padding: 0em; }
 th.centered { text-align: center; }
+ul { margin: 0; }
+details > summary {
+    list-style-type: none;
+}
+details > summary.has_dependers {
+    list-style-type: '▶';
+}
+details[open] > summary.has_dependers {
+    list-style-type: '▼';
+}
+details > summary.has_deps::after {
+    content: '▶';
+}
+details[open] > summary.has_deps::after {
+    content: '▼';
+}
 {% endblock %}
 
 {% block content %}
 {% endblock %}
 
 {% block content %}
@@ -22,6 +38,39 @@ comment: <input name="day_comment" value="{{day.comment|e}}">
 <input type="hidden" name="date" value="{{day.date}}" />
 </p>
 
 <input type="hidden" name="date" value="{{day.date}}" />
 </p>
 
+<p>
+task quick-add: <input name="choose_task" size=50 list="tasks" autocomplete="off">
+don't adopt, make new: <input type="checkbox" name="dont_adopt" />
+</p>
+<datalist id="tasks">
+{% for task in all_tasks %}
+<option value="{{task.id_}}">({{task.subtask_depth}}) {{task.title.now}}</option>
+{% endfor %}
+</datalist>
+
+{% if adoptable_past_todos %}
+<p>
+<details>
+<summary>
+there are adoptable/unfinished past todos ({{adoptable_past_todos|count}})
+</summary>
+<table class="alternating">
+<tr>
+<th>adopt?</th><th>date</th><th>title</th><th>comment</th>
+</tr
+{% for todo in adoptable_past_todos %}
+<tr>
+<td class="checkbox"><input name="choose_todo" type="checkbox" value="{{todo.id_}}"></td>
+<td>{{todo.earliest_date}}</td>
+<td><a href="todo?id={{todo.id_}}">{{todo.title|e}}</a></td>
+<td>{{todo.comment|e}}</td>
+</tr>
+{% endfor %}
+</table>
+</details>
+</p>
+{% endif %}
+
 <table class="alternating">
 <tr>
 <th {% if sort=='done' %}class="desc"{% endif %}>
 <table class="alternating">
 <tr>
 <th {% if sort=='done' %}class="desc"{% endif %}>
@@ -43,7 +92,7 @@ comment: <input name="day_comment" value="{{day.comment|e}}">
 <tr>
 <input name="todo_id" value="{{todo.id_}}" type="hidden" >
 <td class="checkbox">
 <tr>
 <input name="todo_id" value="{{todo.id_}}" type="hidden" >
 <td class="checkbox">
-<input name="done" type="checkbox" value="{{todo.id_}}" {% if todo.done %}checked{% endif %}>
+<input name="done" type="checkbox" value="{{todo.id_}}" {% if todo.done %}checked{% endif %} {% if todo.deps_done == false %}disabled{% endif %}>
 </td>
 <td class="number">
 <input class="effort_input" name="effort" type="number" step=0.1 size=7 value="{% if todo.day_effort is not none %}{{todo.day_effort}}{% endif %}" placeholder={{"%.1f"|format(todo.task.default_effort.then)}} >
 </td>
 <td class="number">
 <input class="effort_input" name="effort" type="number" step=0.1 size=7 value="{% if todo.day_effort is not none %}{{todo.day_effort}}{% endif %}" placeholder={{"%.1f"|format(todo.task.default_effort.then)}} >
@@ -52,7 +101,31 @@ comment: <input name="day_comment" value="{{day.comment|e}}">
 <input name="importance" type="number" step=0.1 size=7 value={{todo.importance}} } >
 </td>
 <td>
 <input name="importance" type="number" step=0.1 size=7 value={{todo.importance}} } >
 </td>
 <td>
-<a href="todo?id={{todo.id_}}&return_to=do_todos">{% if todo.parents|length > 0 %}…:{% endif %}{{todo.title}}</a>
+{% if todo.dependers|length > 0 or todo.deps|length > 0 %}
+<details>
+<summary class="{% if todo.dependers|length > 0 %}has_dependers{% endif %} {% if todo.deps|length > 0 %}has_deps{% endif %}">
+{% endif %}
+<a href="todo?id={{todo.id_}}&return_to=do_todos">{{todo.title|e}}</a>
+{% if todo.dependers|length > 0 or todo.deps|length > 0 %}
+</summary>
+{% if todo.dependers|length > 0 %}
+dependers:
+<ul>
+{% for path in todo.depender_paths %}
+<li>{% for depender_todo in path %}<a href="todo?id={{depender_todo.id_}}&return_to=do_todos">{{ depender_todo.title|e }}</a> ▶ {% endfor %}…
+{% endfor %}
+</ul>
+{% endif %}
+{% if todo.deps|length > 0 %}
+depends on:
+<ul>
+{% for dep_todo in todo.deps %}
+<li>[{% if dep_todo.done %}✓{% else %} {% endif %}] <a href="todo?id={{dep_todo.id_}}&return_to=do_todos">{{ dep_todo.title|e }}</a>{% if dep_todo.deps|length > 0 %} ▶{% endif %}
+{% endfor %}
+</ul>
+{% endif %}
+</details>
+{% endif %}
 </td>
 <td>
 <input name="effort_comment" type="text" size=100 value="{{todo.comment|e}}" />
 </td>
 <td>
 <input name="effort_comment" type="text" size=100 value="{{todo.comment|e}}" />
index 2666d0da260cb1ea2ba1109adb8403b559678fe5..7284f1bdc7218f0f85c54f5a6c5d94a6b4c92b84 100644 (file)
@@ -63,9 +63,6 @@ tr.lowlevel td, tr.lowlevel th { padding-top: 0em; }
 <tr class="toplevel">
 <th>tags</th>
 <td>
 <tr class="toplevel">
 <th>tags</th>
 <td>
-       <!--
-add: <input name="tag" value="" size=15 >
-       -->
 add: {{ macros.tagselection(submit_name='tag', selected_tags=task.tags.now, all_tags=tags) }}
 <details>
 <summary>history</summary>
 add: {{ macros.tagselection(submit_name='tag', selected_tags=task.tags.now, all_tags=tags) }}
 <details>
 <summary>history</summary>
index a125985d9df32c85d338a327f0f1d00985531d37..90f43585e1b956f8be0562e21b8398e5450746dd 100644 (file)
@@ -1,4 +1,5 @@
 {% extends 'base.html' %}
 {% extends 'base.html' %}
+
 {% block css %}
 table.alternating tr:nth-child(even) {
     background-color: #cccccc;
 {% block css %}
 table.alternating tr:nth-child(even) {
     background-color: #cccccc;
@@ -6,44 +7,47 @@ table.alternating tr:nth-child(even) {
 table.alternating tr:nth-child(odd) {
     background-color: #ffffff;
 }
 table.alternating tr:nth-child(odd) {
     background-color: #ffffff;
 }
-td.number { text-align: right; }
-tr.expanded { color: #888888; }
 {% endblock %}
 {% endblock %}
+
 {% block content %}
 {% block content %}
+<h3>review tasks</h3>
+
 <form action="tasks" method="POST">
 {% include 'tagfilters.html' %}
 <form action="tasks" method="POST">
 {% include 'tagfilters.html' %}
+<br />
+match: <input name="search" value="{{search|e}}" />
+<input id="filter_button" type="submit" name="filter" value="match" />
 </form>
 </form>
-<table class="alternating">
-<tr><th>default<br />effort</th><th>task</th><th>tags</th></tr>
 
 
-{% for uuid, t in db.tasks.items() | sort(attribute='1.title.now') %}
+<table class="alternating">
+<tr>
+<th class="centered{% if sort=='default_effort' %} desc{% endif %}">
+<a href="?sort=default_effort">effort</a>
+</th>
+<th {% if sort=='depth' %}class ="desc"{% endif %}>
+<a href="?sort=depth">depth</a>
+</th>
+<th {% if sort=='title' %}class="desc"{% endif %}>
+<a href="?sort=title">todo</a>
+</th>
+<th>tags</th>
+</tr>
+{% for t in tasks %}
 {% if t.visible %}
 {% if t.visible %}
-
 <tr>
 <tr>
-<td class="number">{{ t.default_effort.now }}</a></td>
+<td class="number">
+{{ '{:5.1f}'.format(t.default_effort.now) }}
+</td>
+<td class="number">
+{{ '{:5.1f}'.format(t.subtask_depth) }}
+</td>
 <td>
 <td>
-{% if uuid == expand_uuid %}
-<a href="tasks">[-]</a>
-{% elif t.subtasks|count > 0 %}
-<a href="tasks?expand_uuid={{uuid}}">[+]</a>
-{% endif %}
-<a href="task?id={{ uuid }}" />{{ t.title.now|e }}</a></td>
+<a href="task?id={{ t.id_ }}" />{{ t.title.now|e }}</a></td>
 <td>{% for tag in t.tags.now | sort %}<a href="tasks?and_tag={{tag|e}}">{{ tag }}</a> {% endfor %}</td>
 </tr>
 <td>{% for tag in t.tags.now | sort %}<a href="tasks?and_tag={{tag|e}}">{{ tag }}</a> {% endfor %}</td>
 </tr>
-
-{% if uuid == expand_uuid %}
-{% for uuid, t in expanded_tasks.items() %}
-<tr class="expanded">
-<td class="number">{{ t.default_effort }}</a></td>
-<td>&nbsp; [+] <a href="task?id={{ uuid }}" />{{ t.title.now|e }}</a></td>
-<td>{% for tag in t.tags.now | sort %}<a href="tasks?and_tag={{tag|e}}">{{ tag }}</a> {% endfor %}</td>
-</tr>
-{% endfor %}
-{% endif %}
-
 {% endif %}
 {% endfor %}
 {% endif %}
 {% endfor %}
-
 </table>
 </table>
+
 {% endblock %}
 
 {% endblock %}
 
index 45ed8a88bd21e63f334d3fd950f7f4df6eb803b4..88fa72b2e0ec6fc9afb0abd7b8f89b2ab7b45e70 100644 (file)
@@ -30,13 +30,10 @@ tr.lowlevel td, tr.lowlevel th { padding-top: 0em; }
 <tr class="toplevel">
 <th>work</th>
 <td>
 <tr class="toplevel">
 <th>work</th>
 <td>
-{% if todo.children %}
-[{% if todo.done %}✓{% else %} {% endif %}]
-{% else %}
-<input type="checkbox" name="done" {% if todo.done %}checked{% endif %}/>
-{% endif %}
+<input type="checkbox" name="done" {% if todo.done %}checked{% endif %} {% if todo.deps_done == false %}disabled{% endif %}/>
 done<br />
 done<br />
-(sum: {{todo.all_days_effort}})
+(all days: {{todo.all_days_effort}})<br />
+(dependencies: {{todo.all_days_effort}})
 </td>
 <td>
 <table>
 </td>
 <td>
 <table>
@@ -51,10 +48,10 @@ done<br />
 <input name="effort_date" type="hidden" value="{{date}}">{{date}}
 </td>
 <td>
 <input name="effort_date" type="hidden" value="{{date}}">{{date}}
 </td>
 <td>
-<input type="number" name="effort" step=0.1 size=8 value="{{effort}}" placeholder="{{todo.default_effort}}" {% if todo.children and effort %}disabled{% endif %} />
+<input type="number" name="effort" step=0.1 size=8 value="{{effort}}" placeholder="{{todo.default_effort}}" {% if todo.deps and effort %}disabled{% endif %} />
 </td>
 <td>
 </td>
 <td>
-{% if not (todo.children and effort) %}<input type="checkbox" name="delete_effort" value="{{date}}" />{% endif %}
+{% if not (todo.deps and effort) %}<input type="checkbox" name="delete_effort" value="{{date}}" />{% endif %}
 </td>
 </tr>
 {% endfor %}
 </td>
 </tr>
 {% endfor %}
@@ -63,7 +60,7 @@ done<br />
 <input name="effort_date" size=10 value="">
 </td>
 <td>
 <input name="effort_date" size=10 value="">
 </td>
 <td>
-<input type="number" name="effort" step=0.1 size=8 value="" {% if todo.children %} disabled {% else %} placeholder="{{todo.default_effort}}" {% endif %} />
+<input type="number" name="effort" step=0.1 size=8 value="" {% if todo.deps %} disabled {% else %} placeholder="{{todo.default_effort}}" {% endif %} />
 </td>
 </tr>
 </table>
 </td>
 </tr>
 </table>
@@ -87,13 +84,13 @@ new: <input name="tag" value="" size=15 >
 </td>
 </tr>
 
 </td>
 </tr>
 
-{% if todo.parents %}
+{% if todo.dependers %}
 <tr class="toplevel">
 <tr class="toplevel">
-<th>parents</th>
+<th>dependers</th>
 <td colspan=2>
 <ul>
 <td colspan=2>
 <ul>
-{% for parent in todo.parents %}
-<li><a href="todo?id={{parent.id_}}">{{parent.title}}</a>
+{% for depender in todo.dependers %}
+<li><a href="todo?id={{depender.id_}}">{{depender.title}}</a>
 {% endfor %}
 </ul>
 </td>
 {% endfor %}
 </ul>
 </td>
@@ -101,16 +98,16 @@ new: <input name="tag" value="" size=15 >
 {% endif %}
 
 <tr class="toplevel">
 {% endif %}
 
 <tr class="toplevel">
-<th>children</th>
+<th>dependencies</th>
 <td colspan=2>
 <td colspan=2>
-{% if todo.children %}
+{% if todo.deps %}
 <table>
 <tr class="lowlevel">
 <th>adopted</th><th>effort</th><th>title</th><th>comments</th>
 </tr>
 <table>
 <tr class="lowlevel">
 <th>adopted</th><th>effort</th><th>title</th><th>comments</th>
 </tr>
-{% for todo in child_todos %}
+{% for todo in dep_todos %}
 <tr class="lowlevel">
 <tr class="lowlevel">
-<td class="center"><input name="adopt_child" type="checkbox" value="{{todo.id_}}" checked/></td>
+<td class="center"><input name="adopt_dep" type="checkbox" value="{{todo.id_}}" checked/></td>
 <td class="number">{{ '{:2.1f}'.format(todo.all_days_effort) }} {% if todo.done %}✓{% else %}&nbsp;{% endif %}</td>
 <td><a href="todo?id={{todo.id_}}">{{todo.day.date}} {{todo.title}}</a></td>
 <td>{{todo.comment}}</td>
 <td class="number">{{ '{:2.1f}'.format(todo.all_days_effort) }} {% if todo.done %}✓{% else %}&nbsp;{% endif %}</td>
 <td><a href="todo?id={{todo.id_}}">{{todo.day.date}} {{todo.title}}</a></td>
 <td>{{todo.comment}}</td>
@@ -120,11 +117,11 @@ new: <input name="tag" value="" size=15 >
 {% endif %}
 <br />
 make from task:<br />
 {% endif %}
 <br />
 make from task:<br />
-<input name="birth_child" list="tasks" size=100><br />
+<input name="birth_dep" list="tasks" size=100><br />
 adopt (from <input name="start" {% if start_date %}value="{{ start_date }}"{% endif %} placeholder="yesterday" /> to <input name="end" {% if end_date %}value="{{ end_date }}"{% endif %} placeholder="2030-12-31" />):<br />
 adopt (from <input name="start" {% if start_date %}value="{{ start_date }}"{% endif %} placeholder="yesterday" /> to <input name="end" {% if end_date %}value="{{ end_date }}"{% endif %} placeholder="2030-12-31" />):<br />
-<input name="adopt_child" list="todos" size=100>
+<input name="adopt_dep" list="todos" size=100>
 <datalist id="todos">
 <datalist id="todos">
-{% for todo in filtered_todos %}<option value="{{todo.id_}}">{{ '{:2.1f}'.format(todo.all_days_effort) }} {% if todo.done %}✓{% else %}&nbsp;&nbsp;{% endif %} {{todo.day.date}} {{todo.title}}</option>
+{% for todo in filtered_todos %}<option value="{{todo.id_}}">{{ '{:2.1f}'.format(todo.all_days_effort) }} {% if todo.done %}✓{% else %}&nbsp;&nbsp;{% endif %} {{todo.day.date}} {{todo.title}} {{todo.comment}}</option>
 {% endfor %}
 </datalist>
 <datalist id="tasks">
 {% endfor %}
 </datalist>
 <datalist id="tasks">