Edgewall Software
Modify

Opened 16 years ago

Closed 14 years ago

#6319 closed defect (worksforme)

Literal '%' gets duplicated in report with $VARIABLE replacement

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

Description

I'm using the reporting engine to generate some summaries for milestones and I'm generating a percentage and wanted to concat a '%' character to my percentage. Fairly Standard. This works fine until I use a parameter to the report to customize it, at which point the '%' gets duplicated.

No doubt this is an attempt somewhere to escape the % sign while processing the query for the report.

Here's an example to reproduce this, using some minor modifications the standard 'Active Tickets by Milestone' report.

SELECT p.value AS __color__,
   concat('Milestone % ', milestone) AS __group__,
   id AS ticket, summary, component, version as _version, t.type AS _type, 
   owner, status, j.value as 'planned end date', k.value as 'hours left', 
   time 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'
  LEFT JOIN ticket_custom k on t.id = k.ticket and k.name = 'hours_left'
  LEFT JOIN ticket_custom j on t.id = j.ticket and j.name = 'planned_end_date'
  WHERE status <> 'closed' 
  and milestone = '$MILESTONE'
  ORDER BY (milestone IS NULL),milestone, p.value, t.type, time

Then run this report with ?MILESTONE=<some milestone in your system> and notice that the header will now contain two '%' charecters. Removing the $MILESTONE from the query will display the '%' correctly.

I looked through report.py quickly, but I'm not too familiar with it and didn't see anything glaring. Currently running r6121

Attachments (0)

Change History (4)

in reply to:  description comment:1 by anonymous, 16 years ago

Just noticed I left some custom fields in the SQL.. it should look like this:

 SELECT p.value AS __color__,
    concat('Milestone % ', milestone) AS __group__,
    id AS ticket, summary, component, version as _version, t.type AS _type, 
    owner, status, 
    time 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 <> 'closed' 
   and milestone = '$MILESTONE'
   ORDER BY (milestone IS NULL),milestone, p.value, t.type, time

comment:2 by Christian Boos, 16 years ago

Keywords: verify added
Milestone: 0.11.1
Severity: minornormal

comment:3 by Remy Blank, 16 years ago

I assume you are running Trac on MySQL, judging from the concat(). I cannot reproduce this with SQLite. Could you please test that the problem still appears using the latest 0.11-stable? If it does, then it is most likely MySQL-specific.

Please also set the log level to debug, and check the SQL query that is sent to the DB (the log entry starts with "DEBUG: Query SQL:").

comment:4 by Remy Blank, 14 years ago

Milestone: next-minor-0.12.x
Resolution: worksforme
Status: newclosed

No reply for 18 months, closing.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Matthew Good.
The resolution will be deleted. Next status will be 'reopened'.
to 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.