03 August 2007

Closed in the Last 7 Days

I use trac for most of my project management purposes. One issue I had for quite some time was that I did not have a report showing me what tickets were closed in the last x amount of time. After studying the stock reports and digging through the database I found what I needed. The following query generates a report showing a list of closed tickets over the last 7 days (actually 604800 seconds).

SELECT id AS ticket, summary, component, version,
priority, t.type AS type, owner, resolution,
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'
AND _changetime > (strftime('%s','now')-604800)
ORDER BY changetime DESC

I hope this report will help someone else. Enjoy!

No comments: