+ task_rows = []
+ for uuid, task in self.tasks.items():
+ if not task.visible:
+ continue
+ todo = None
+ if uuid in self.selected_day.todos.keys():
+ todo = self.selected_day.todos[uuid]
+ if not todo.visible:
+ continue
+ task_rows += [{'uuid': uuid, 'task': task, 'todo': todo}]
+ if task_sort == 'title':
+ task_rows.sort(key=lambda r: r['task'].title)
+ elif task_sort == 'default_effort':
+ task_rows.sort(key=lambda r: r['task'].default_effort, reverse=True)
+ elif task_sort == 'done':
+ task_rows.sort(key=lambda r: 0 if not r['todo'] else r['todo'].day_effort if r['todo'].day_effort else r['task'].default_effort if r['todo'].done else 0, reverse=True)
+ elif task_sort == 'importance':
+ task_rows.sort(key=lambda r: 0.0 if not r['todo'] else r['todo'].importance, reverse=True)
+ elif task_sort == 'chosen':
+ task_rows.sort(key=lambda r: False if not r['todo'] else True, reverse=True)
+ elif task_sort == 'comment':
+ task_rows.sort(key=lambda r: '' if not r['todo'] else r['todo'].comment, reverse=True)
+ return j2env.get_template('day.html').render(db=self, action=self.prefix+'/day', prev_date=prev_date_str, next_date=next_date_str, task_rows=task_rows)