From a95a1a2fc8a60ca29199c029a18d9b063c3ea830 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Tue, 21 May 2024 03:12:46 +0200 Subject: [PATCH 1/1] Fix. --- new_todo/init.sql | 1 - todo.py | 19 ++++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) 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] -- 2.30.2