{7} My Tickets

This report demonstrates the use of the automatically set USER dynamic variable, replaced with the username of the logged in user when executed.

Report execution failed:
ProgrammingError: for SELECT DISTINCT, ORDER BY expressions must appear in select list
LINIA 19:   ORDER BY (owner = 'anonymous' AND status = 'accepted') DES...
                      ^

SELECT COUNT(*) FROM (
SELECT DISTINCT
       p.value AS __color__,
       (CASE
         WHEN owner = %s AND status = 'accepted' THEN 'Accepted'
         WHEN owner = %s THEN 'Owned'
         WHEN reporter = %s THEN 'Reported'
         ELSE 'Commented' 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,
       reporter AS _reporter
  FROM ticket t
  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
  LEFT JOIN ticket_change tc ON tc.ticket = t.id AND tc.author = %s
                                AND tc.field = 'comment'
  WHERE t.status <> 'closed'
        AND (owner = %s OR reporter = %s OR author = %s)
  ORDER BY (owner = %s AND status = 'accepted') DESC,
           owner = %s DESC, reporter = %s DESC,
           CAST(p.value AS int), milestone, t.type, t.time

) AS tab
Note: See TracReports for help on using and creating reports.