I really appreciate the current Report module. The SQL-query together with formatting really gives us the ability to create reports according to customers demand.

Could it be possible keep it in some different form? Maybe like a SQL-query to a "fake" table.

/ tomas


Gary Oberbrunner wrote:

I just ran across this note on the TracReports page:

========
   Note: The report module is being phased out in its current form because it
seriously limits the ability of the Trac team to make adjustments to the
underlying database schema. We believe that the query module is a good
replacement that provides more flexibility and better usability. While there
are certain reports that cannot yet be handled by the query module, we intend
to further enhance it so that at some point the reports module can be
completely removed. This also means that there will be no major enhancements
to the report module anymore.
========


OK, seems like a good idea.  But some of our reports can't be done in the trac
mini-query language.  Here's one which gives all open tickets sorted by age,
with a column showing the age in days:

SELECT p.value AS __color__,
  id AS ticket,  round((strftime('%s','now')-time)/86400) as "Days Old", time
as created, owner, summary, milestone,
  changetime AS _changetime, description AS _description,
  reporter AS _reporter
 FROM ticket t, enum p
 WHERE status IN ('new', 'assigned', 'reopened')
AND p.name = t.priority AND p.type = 'priority'
 ORDER BY time

The strftime expression is the problem.  Here's another similar report,
"Tickets closed recently":

select id, summary, component, milestone, owner,
 (select max(tc.time) from ticket_change tc
    where t.id = tc.ticket and field = 'status' and newvalue = 'closed')
  as closetime,
 datetime((select max(tc.time) from ticket_change tc
    where t.id = tc.ticket and field = 'status' and newvalue = 'closed'),
'unixepoch', 'localtime') as closedate
 from ticket t
where status = 'closed'  and closetime > strftime('%s',datetime("now","-2
days"))+0
order by closetime;

Same kind of thing, except we need to add 0 to convert to the time back to
numeric type for the comparison.

Another thing is there's no good way to specify what columns to display; the
"compact" option is too limiting.

Also, how would the TicketBox macro work without reports?  Here's a report we
use with TicketBox:
SELECT id as ticket, status, "("||milestone||") "||summary as text, milestone
 FROM ticket
 WHERE status IN ('new', 'assigned', 'reopened') and component = "$COMPONENT"
 ORDER BY milestone, id

Note the customized formatting.

And one more question: how are spaces e.g. in milestone names handled?  There
must be a quoting syntax but it's not described on the TracQuery page.


-- Gary Oberbrunner
_______________________________________________
Trac mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac



_______________________________________________
Trac mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac

Reply via email to