Ticket #708 (closed bug: fixed)

Opened 13 years ago

Last modified 13 years ago

Trac ticket report {8} (Active Tickets, Mine first) does not work as advertised

Reported by: Util Owned by: Util
Priority: minor Milestone:
Component: website Version:
Severity: low Keywords: trac ticket report SQL
Cc: Language:
Patch status: Platform:

Description (last modified by Util) (diff)

Ticket report {8} describes itself as:

  • List all active tickets by priority.
  • Show all tickets owned by the logged in user in a group first.

The report does make a separate group(s) of the user's tickets, but fails to sort on the grouping criteria, causing the group to appear at some random point anywhere in the multi-page report, and usually causing multiple sub-groups instead of a single "Mine" group.

Change History

Changed 13 years ago by Util

  • status changed from new to assigned

Changed 13 years ago by Util

For reference, here is the original (faulty) SQL code of the report:

SELECT p.value AS __color__,
   (CASE owner 
     WHEN $USER THEN 'My Tickets' 
     ELSE 'Active Tickets' 
    END) AS __group__,
   id AS ticket, summary, component, version, milestone, t.type AS type, 
   owner, status,
   time AS created,
   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'
  WHERE status <> 'closed' 
  ORDER BY (owner = $USER) DESC, p.value, milestone, t.type, time

Changed 13 years ago by Util

Changes made:

  1. Resolved the issue by sorting on the grouping criteria.
  2. Moved the the sort fields to be the first columns of the report, to make the sort order evident.
  3. Changed the population of the numeric Priority from a LEFT JOIN to a sub-select, for clarity.
  4. Formatted the SQL.

Closing ticket.

Changed 13 years ago by Util

  • description modified (diff)

Changed 13 years ago by Util

  • status changed from assigned to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.