Ticket #6319 (new defect)
Literal '%' gets duplicated in report with $VARIABLE replacement
| Reported by: | ryank@… | Owned by: | mgood |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.11-retriage |
| Component: | report system | Version: | devel |
| Severity: | normal | Keywords: | verify |
| Cc: |
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


