Issue Details (XML | Word | Printable)

Key: MPDASHBOARD-22
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Trivial Trivial
Assignee: Vincent Massol
Reporter: Morten Kristiansen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Maven 1.x Dashboard Plugin

Add "Total" to dashboard report

Created: 19/Apr/05 06:14 PM   Updated: 18/May/05 03:10 AM   Resolved: 18/May/05 03:10 AM
Return to search
Component/s: None
Affects Version/s: 1.7
Fix Version/s: 1.8

Time Tracking:
Not Specified

File Attachments: None
Image Attachments:

1. dashboard-total.png
(115 kB)


 Description  « Hide

Modify jsl to include a "Total" row at bottom of table. See attached image. My code isn't 100%, but as you see it will calculate values correct even if there are some "-" rows. For rows like "xx %", NaN will show up.

Jsl code is quite straight forward (could propably be re-written; my xpath knowledge isn't that good):

<tr>
<td><b>Total</b></td>
<x:forEach var="aggregatorName" select="project[1]/aggregator/@name">
<td>
<b>
<x:expr select="sum(//aggregator[@name='${aggregatorName.value}'][not(text()='-')][text()])"/>
</b>
</td>
</x:forEach>
</tr>

Or do you want a scm diff on this?



Vincent Massol added a comment - 22/Apr/05 07:51 AM

Applied thanks.


Morten Kristiansen added a comment - 29/Apr/05 04:30 AM

If you replace this text in the modified dashboard.jsl section i posted, we will get '0' instead of 'NaN' for % columns:

<x:expr select="sum(//aggregator[@name='${aggregatorName.value}'][not(text()='-') and not(contains(text(), '%'))][text()])"/>


Vincent Massol added a comment - 29/Apr/05 04:33 AM

Thanks Morten. Actually, I prerfer NaN over 0 as it's not a number!

That said, the best would really be "N/A" instead of NaN.


Morten Kristiansen added a comment - 29/Apr/05 07:17 AM

I see your point. What we could do is to use the "old" <x:expr select..>" but store the select with a <x:set var="theTotal" select=..> and use <j:if..> to set theTotal to "N/A" if theTotal is "NaN".


Morten Kristiansen added a comment - 18/May/05 02:26 AM

Here's the new N/A code:

<tr>
<td><b>Total</b></td>
<x:forEach var="aggregatorName" select="project[1]/aggregator/@name">
<td>
<b>
<x:set var="theTotal" select="sum(//aggregator[@name='${aggregatorName.value}'][not(text()='-')][text()])"/>
<j:if test="${theTotal == 'NaN'}">
<j:set var="theTotal" value="N/A" />
</j:if>
<x:expr select="round(${theTotal})" />
</b>
</td>
</x:forEach>
</tr>


Morten Kristiansen added a comment - 18/May/05 02:51 AM

Sorry. THIS is more correct:

<tr>
<td><b>Total</b></td>
<x:forEach var="aggregatorName" select="project[1]/aggregator/@name">
<td>
<b>
<x:set var="theTotal" select="sum(//aggregator[@name='${aggregatorName.value}'][not(text()='-')][text()])"/>
<j:choose>
<j:when test="${theTotal == 'NaN'}">
<x:expr select="string('N/A')" />
</j:when>
<j:otherwise>
<x:expr select="round(${theTotal})" />
</j:otherwise>
</j:choose>
</b>
</td>
</x:forEach>
</tr>


Vincent Massol added a comment - 18/May/05 03:10 AM

Applied. Thanks.