home · contact · privacy
Fix.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 21 May 2024 01:12:46 +0000 (03:12 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 21 May 2024 01:12:46 +0000 (03:12 +0200)
new_todo/init.sql
todo.py

index 1a91146ae4285a51a9855fafd56e3a4778413392..a911fb02c8f21cb5383e42886fad3e71322674a5 100644 (file)
@@ -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 dc3a346efebccc30be5d82e1840b635d79c0b5b2..8f73e86b973ea1d92e9f5cd4a08b2d34212bc499 100644 (file)
--- 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]