Showing posts with label report. Show all posts
Showing posts with label report. Show all posts

Thursday, January 5, 2012

Fullnames in trac reports

So you are using the excellent trac tool to manage your project, right? And you'd like to see the fullname of the project participants in your reports.
Then here's a quick tip on how to do it. Basically trac as of v0.12 keeps users' profile data (fullname, email) in the session_attribute table. So you'll have to join it in your report queries.

Eg. let's see the very basic 'Active Tickets' report which comes with the base install. Modify it to look like this:

SELECT p.value AS __color__,
id AS ticket, summary, component, version, milestone, t.type AS type,
session_attribute.value as owner, status,
time AS created,
changetime AS _changetime, description AS _description,
reporter AS _reporter
FROM ticket t
LEFT JOIN session_attribute on t.owner = session_attribute.sid AND'name'
LEFT JOIN enum p ON = t.priority AND p.type = 'priority'
WHERE status <> 'closed'
ORDER BY CAST(p.value AS integer), milestone, t.type, time

Note, that for this solution to work you'll need to check if users fill their profile data correctly (in the Preferences menu).