Pirate Party Ad

tisdag 5 januari 2010

Hiding master tickets in Trac

Are you using the MasterTicketsPlugin for Trac? Have you ever wanted to hide the tickets assigned to you that cannot be fixed because they are blocked by other tickets? Here's a nifty code that does just that.

To do this you need to have Trac permission to create a custom ticket report.

  1. Open up Trac in a browser of your choice.
  2. Click "View Tickets".
  3. Click the button "Create new report".

  4. Add a description like "My tickets, also showing tickets that are blocked.

  5. Name the report something like "My tickets deluxe".
  6. Paste the following code into "Query for Report":

    SELECT p.value AS __color__,
    (CASE LENGTH(tc.value) WHEN 0 THEN CASE status WHEN 'assigned' THEN 'Assigned' ELSE 'Owned' END ELSE 'Blocked by another ticket' END) AS __group__,
    id AS ticket, summary, component, version, milestone,
    t.type AS type, severity, priority, time AS created,
    changetime AS _changetime, description AS _description,
    reporter AS _reporter
    FROM ticket t, enum p
    LEFT JOIN ticket_custom tc ON (t.id=tc.ticket AND tc.name='blockedby')
    WHERE
    t.status <> 'closed'
    AND
    p.name = t.priority
    AND
    p.type = 'priority'
    AND
    owner = '$USER'
    GROUP BY t.id
    ORDER BY LENGTH(tc.value), (status = 'assigned') DESC, p.value, milestone, severity, time


  7. Click "Save report", and you're done!


Good luck!

Inga kommentarer: