From: Christian Heller Date: Tue, 21 May 2024 01:12:46 +0000 (+0200) Subject: Fix. X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/ledger?a=commitdiff_plain;h=a95a1a2fc8a60ca29199c029a18d9b063c3ea830;p=misc Fix. --- diff --git a/new_todo/init.sql b/new_todo/init.sql index 1a91146..a911fb0 100644 --- a/new_todo/init.sql +++ b/new_todo/init.sql @@ -29,5 +29,4 @@ CREATE TABLE versioned_titles ( title TEXT NOT NULL, PRIMARY KEY (template, datetime), FOREIGN KEY (template) REFERENCES templates(id) - ); diff --git a/todo.py b/todo.py index dc3a346..8f73e86 100644 --- a/todo.py +++ b/todo.py @@ -239,15 +239,16 @@ class Day: def sorted_todos(self, done, is_tree_shaped, sort_order, legal_keys): todos = [t for t in self.linked_todos_as_list if t.visible and t.done == done] - reverse = False - sort_column = sort_order[:] - if sort_order and '-' == sort_order[0]: - reverse = True - sort_column = sort_order[1:] - if sort_column in legal_keys: - todos.sort(key=lambda t: getattr(t, sort_column)) - if reverse: - todos.reverse() + if sort_order: + reverse = False + sort_column = sort_order[:] + if sort_order and '-' == sort_order[0]: + reverse = True + sort_column = sort_order[1:] + if sort_column in legal_keys: + todos.sort(key=lambda t: getattr(t, sort_column)) + if reverse: + todos.reverse() if is_tree_shaped: def walk_tree(todo, sorted_todos): todo.deps = [t for t in sorted_todos if t in todo.deps]