Edgewall Software
Modify

Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#5173 closed defect (fixed)

TicketGroupStats macro fails if count(stats.intervals) != 2

Reported by: PuetzKevinA@… 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  
    227227      </py:for>
    228228      <py:if test="stats_href">
    229229        <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>
    231231      </py:if>
    232232    </dl>
    233233</py:def>

Attachments (0)

Change History (3)

comment:1 by Christian Boos, 18 years ago

Milestone: 0.11
Owner: changed from Christopher Lenz to Christian Boos
Severity: normalminor
Status: newassigned

Nice catch.

comment:2 by Christian Boos, 18 years ago

Resolution: fixed
Status: assignedclosed

Patch applied in r5221.

comment:3 by Christian Boos, 18 years ago

Erm, make that r5222

Modify Ticket

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