From 014e59d97c912cff4ae2922c1d9284c086694cf1 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Mon, 17 Jun 2024 14:17:19 +0200
Subject: [PATCH] Default all GET ?sort_by= to "title" also in
 params-re-writing.

---
 plomtask/http.py | 3 +++
 1 file changed, 3 insertions(+)

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
-- 
2.30.2