Commits

Anonymous committed e074d0c Draft

trac: fixes report 7 for postgres query with patch suggested in trac:ticket:9311 - closes #30

Comments (0)

Files changed (1)

trac/db_default.py

 logged in user when executed.
 """,
 """\
-SELECT DISTINCT
-       p.value AS __color__,
+SELECT  __color__, __group,
        (CASE
-         WHEN owner = $USER AND status = 'accepted' THEN 'Accepted'
-         WHEN owner = $USER THEN 'Owned'
-         WHEN reporter = $USER THEN 'Reported'
+         WHEN __group = 1 THEN 'Accepted'
+         WHEN __group = 2 THEN 'Owned'
+         WHEN __group = 3 THEN 'Reported'
          ELSE 'Commented' END) AS __group__,
+       ticket, summary, component, version, milestone,
+       type, priority, created, _changetime, _description,
+       _reporter
+FROM (
+ SELECT DISTINCT """ + db.cast('p.value', 'int') + """ AS __color__,
+      (CASE
+         WHEN owner = $USER AND status = 'accepted' THEN 1
+         WHEN owner = $USER THEN 2
+         WHEN reporter = $USER THEN 3
+         ELSE 4 END) AS __group,
        t.id AS ticket, summary, component, version, milestone,
        t.type AS type, priority, t.time AS created,
        t.changetime AS _changetime, description AS _description,
                                 AND tc.field = 'comment'
   WHERE t.status <> 'closed'
         AND (owner = $USER OR reporter = $USER OR author = $USER)
-  ORDER BY (owner = $USER AND status = 'accepted') DESC,
-           owner = $USER DESC, reporter = $USER DESC,
-           """ + db.cast('p.value', 'int') + """, milestone, t.type, t.time
+) AS sub
+ORDER BY __group, __color__, milestone, type, created
 """),
 #----------------------------------------------------------------------------
 ('Active Tickets, Mine first',
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.