From: Christian Heller
Date: Mon, 5 Feb 2024 07:12:17 +0000 (+0100)
Subject: Improve accounting scripts.
X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/static/%7B%7B%20web_path%20%7D%7D/ledger?a=commitdiff_plain;h=59056f396c4761f9cd7ffbc569e3ddf8994d5e83;p=misc
Improve accounting scripts.
---
diff --git a/ledger.py b/ledger.py
index 656a26e..958852a 100755
--- 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
+ delete = False
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':
- 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:
diff --git a/todo.py b/todo.py
index 11b0149..6c84ee0 100644
--- a/todo.py
+++ b/todo.py
@@ -87,7 +87,7 @@ class Task:
self.comment = comment
self.visible = True
- self.parents = []
+ self.dependers = []
@classmethod
def from_dict(cls, db, d, id_):
@@ -119,6 +119,15 @@ class Task:
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"
@@ -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()]:
+ # 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)
@@ -208,18 +218,18 @@ class Todo:
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._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.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_):
@@ -232,7 +242,7 @@ class Todo:
set(d['day_tags']),
d['importance'],
d['efforts'],
- d['children'])
+ d['deps'])
return todo
def to_dict(self):
@@ -243,11 +253,7 @@ class Todo:
'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):
@@ -258,12 +264,12 @@ class Todo:
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):
@@ -271,45 +277,45 @@ class Todo:
@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
- 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:
- 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):
@@ -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 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 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)
@@ -409,8 +415,6 @@ class TodoDB(PlomDB):
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()
@@ -464,27 +468,28 @@ class TodoDB(PlomDB):
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)
- 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
- if t.task.id_ == child_task.id_]
+ if t.task.id_ == dep_task.id_]
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]
@@ -501,11 +506,11 @@ class TodoDB(PlomDB):
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)
- 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!')
- todo.children = children
+ todo.deps = deps
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)
- 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_):
@@ -563,9 +568,16 @@ class TodoDB(PlomDB):
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
- 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':
@@ -580,12 +592,14 @@ class TodoDB(PlomDB):
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,
+ all_tasks=[t for t in self.tasks.values()],
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]
@@ -614,7 +628,7 @@ class TodoDB(PlomDB):
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)
@@ -631,67 +645,73 @@ class TodoDB(PlomDB):
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]
-
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,
+ tasks=filtered_tasks,
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)
+ # 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):
@@ -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 {'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 '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
@@ -864,7 +885,7 @@ class TodoHandler(PlomHandler):
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'):
@@ -881,21 +902,21 @@ class TodoHandler(PlomHandler):
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:
- 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')),
- children=children)
+ deps=deps)
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)]
- 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')))]
@@ -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', '')
+ 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', [])
@@ -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', '')
- if site in {'do_todos', 'pick_tasks', 'calendar', 'task'}:
+ if site in {'do_todos', 'calendar', 'task'}:
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:
@@ -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')
- 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
- 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',
@@ -1026,16 +1053,16 @@ class TodoHandler(PlomHandler):
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':
- 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:
- 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
diff --git a/todo_templates/base.html b/todo_templates/base.html
index 1084e4f..a2d05da 100644
--- a/todo_templates/base.html
+++ b/todo_templates/base.html
@@ -21,8 +21,7 @@ div.delete { float: right; }
{% endblock %}
-tasks: list add | day:
-pick tasks
+tasks: review add | day:
do todos
| calendar
| reset cookie
diff --git a/todo_templates/do_todos.html b/todo_templates/do_todos.html
index fd6feb2..25211f0 100644
--- a/todo_templates/do_todos.html
+++ b/todo_templates/do_todos.html
@@ -5,6 +5,22 @@ td.number, td.checkbox { 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 %}
@@ -22,6 +38,39 @@ comment:
+
+task quick-add:
+don't adopt, make new:
+
+
+
+{% if adoptable_past_todos %}
+
+
+
+there are adoptable/unfinished past todos ({{adoptable_past_todos|count}})
+
+
+
+
+{% endif %}
+
@@ -43,7 +92,7 @@ comment:
|
-
+
|
@@ -52,7 +101,31 @@ comment:
|
-{% if todo.parents|length > 0 %}â¦:{% endif %}{{todo.title}}
+{% if todo.dependers|length > 0 or todo.deps|length > 0 %}
+
+
+{% endif %}
+{{todo.title|e}}
+{% if todo.dependers|length > 0 or todo.deps|length > 0 %}
+
+{% if todo.dependers|length > 0 %}
+dependers:
+
+{% endif %}
+{% if todo.deps|length > 0 %}
+depends on:
+
+{% for dep_todo in todo.deps %}
+- [{% if dep_todo.done %}â{% else %} {% endif %}] {{ dep_todo.title|e }}{% if dep_todo.deps|length > 0 %} â¶{% endif %}
+{% endfor %}
+
+{% endif %}
+
+{% endif %}
|
diff --git a/todo_templates/task.html b/todo_templates/task.html
index 2666d0d..7284f1b 100644
--- a/todo_templates/task.html
+++ b/todo_templates/task.html
@@ -63,9 +63,6 @@ tr.lowlevel td, tr.lowlevel th { padding-top: 0em; }
|
tags |
-
add: {{ macros.tagselection(submit_name='tag', selected_tags=task.tags.now, all_tags=tags) }}
history
diff --git a/todo_templates/tasks.html b/todo_templates/tasks.html
index a125985..90f4358 100644
--- a/todo_templates/tasks.html
+++ b/todo_templates/tasks.html
@@ -1,4 +1,5 @@
{% extends 'base.html' %}
+
{% 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;
}
-td.number { text-align: right; }
-tr.expanded { color: #888888; }
{% endblock %}
+
{% block content %}
+review tasks
+
- |