Modify ↓
#5173 closed defect (fixed)
TicketGroupStats macro fails if count(stats.intervals) != 2
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | normal | Milestone: | 0.11 |
Component: | roadmap | Version: | devel |
Severity: | minor | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
The error occurrs because the reduce the lambda tries to access x.count on the result of the previous addition, which is just an integer, not an interval object:
Here's a patch work right for any number of intervals. This is against the workflow branch, but the code doesn't look any different on trunk.
-
trac/templates/macros.html
old new 227 227 </py:for> 228 228 <py:if test="stats_href"> 229 229 <dt>Total ${stats.unit}s:</dt> 230 <dd><a href="${stats_href}">${ reduce(lambda x, y: x.count + y.count, stats.intervals or [0])}</a></dd>230 <dd><a href="${stats_href}">${sum([x.count for x in stats.intervals],0)}</a></dd> 231 231 </py:if> 232 232 </dl> 233 233 </py:def>
Attachments (0)
Change History (3)
comment:1 by , 18 years ago
Milestone: | → 0.11 |
---|---|
Owner: | changed from | to
Severity: | normal → minor |
Status: | new → assigned |
Note:
See TracTickets
for help on using tickets.
Nice catch.