Browse Source

Add option to sort by project

Change-Id: Icb6cd5cd9d00f166c492abfec75854e16950274e
James E. Blair 2 years ago
parent
commit
14758b1665
2 changed files with 4 additions and 1 deletions
  1. 1
    1
      gertty/config.py
  2. 3
    0
      gertty/db.py

+ 1
- 1
gertty/config.py View File

@@ -54,7 +54,7 @@ class ConfigSchema(object):
54 54
 
55 55
     servers = [server]
56 56
 
57
-    _sort_by = v.Any('number', 'updated', 'last-seen')
57
+    _sort_by = v.Any('number', 'updated', 'last-seen', 'project')
58 58
     sort_by = v.Any(_sort_by, [_sort_by])
59 59
 
60 60
     text_replacement = {'text': v.Any(str,

+ 3
- 0
gertty/db.py View File

@@ -892,6 +892,9 @@ class DatabaseSession(object):
892 892
                 q = q.order_by(change_table.c.last_seen)
893 893
             elif s == 'number':
894 894
                 q = q.order_by(change_table.c.number)
895
+            elif s == 'project':
896
+                q = q.filter(project_table.c.key == change_table.c.project_key)
897
+                q = q.order_by(project_table.c.name)
895 898
         self.database.log.debug("Search SQL: %s" % q)
896 899
         try:
897 900
             return q.all()

Loading…
Cancel
Save