From: Christian Heller <c.heller@plomlompom.de>
Date: Mon, 17 Jun 2024 12:17:19 +0000 (+0200)
Subject: Default all GET ?sort_by= to "title" also in params-re-writing.
X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bdb.prefix%7D%7D/static/bar%20baz.html?a=commitdiff_plain;h=014e59d97c912cff4ae2922c1d9284c086694cf1;p=plomtask

Default all GET ?sort_by= to "title" also in params-re-writing.
---

diff --git a/plomtask/http.py b/plomtask/http.py
index d602f07..55473ea 100644
--- a/plomtask/http.py
+++ b/plomtask/http.py
@@ -374,6 +374,7 @@ class TaskHandler(BaseHTTPRequestHandler):
             todos.sort(key=lambda t: t.date, reverse=True)
         else:
             todos.sort(key=lambda t: t.date)
+            sort_by = 'title'
         return {'start': start, 'end': end, 'process_id': process_id,
                 'comment_pattern': comment_pattern, 'todos': todos,
                 'all_processes': Process.all(self.conn), 'sort_by': sort_by}
@@ -391,6 +392,7 @@ class TaskHandler(BaseHTTPRequestHandler):
             conditions.sort(key=lambda c: c.title.newest, reverse=True)
         else:
             conditions.sort(key=lambda c: c.title.newest)
+            sort_by = 'title'
         return {'conditions': conditions,
                 'sort_by': sort_by,
                 'pattern': pattern}
@@ -478,6 +480,7 @@ class TaskHandler(BaseHTTPRequestHandler):
             processes.sort(key=lambda p: p.title.newest, reverse=True)
         else:
             processes.sort(key=lambda p: p.title.newest)
+            sort_by = 'title'
         return {'processes': processes, 'sort_by': sort_by, 'pattern': pattern}
 
     # POST handlers