Edgewall Software

Opened 12 years ago

Closed 12 years ago

#6610 closed defect (worksforme)

Bug creating new report with custom query

Reported by: msbrogli@… Owned by: Matthew Good
Priority: normal Milestone:
Component: report system Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:


I got an internal error when I create a new report using the following tag:

SELECT p.value AS __color__,
   id AS ticket, summary, component, version, milestone, t.type AS type, 
   (CASE status WHEN 'assigned' THEN owner||' *' ELSE owner END) AS owner,
   datetime(time, 'unixepoch') 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 IN ('new', 'assigned', 'reopened') 
  ORDER BY p.value, milestone, t.type, time

the problem is with datetime command.. it's accepted by sqlite (i tried in sqlite console and worked fine).

Attachments (0)

Change History (2)

comment:1 by Emmanuel Blot, 12 years ago

Severity: blockernormal

comment:2 by osimons, 12 years ago

Resolution: worksforme
Status: newclosed

Problem is that Trac does not understand the custom formatted dates it receives from the SELECT. That is also why you get an error messsage (that you could have included) that (at least for my 0.11b1) says something like:

ValueError: invalid literal for int(): 2007-11-29 23:23:35

For 0.10 it stores and uses unix timestamps, and for 0.11 it still stores timestamps but convert it to Python datetime objects on the fly for all internal use. The formatting is controlled by your Python / Server setttings and can only be changed there - not on input from the database.

For your report, you need to change time back to plain; time AS created.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Matthew Good.
The resolution will be deleted. Next status will be 'reopened'.
to as closed The owner will be changed from Matthew Good to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.