Skip to content

Commit

Permalink
Merge pull request #51 from jenkinsci/relative-values
Browse files Browse the repository at this point in the history
fix wrong calculation for `relative` and `dual` -`displayType`
  • Loading branch information
simonsymhoven authored Sep 8, 2022
2 parents d3143c7 + 8eacc8f commit fda191c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ public Map<String, String> getColors() {
return report.getResult().getColors();
}

public String label(Integer value) {
public String label(String id, Integer value) {
if (item.getResult().size() == 1) {
return item.getLabel(report, value, value / (double) model.getItem().getTotal() * 100);
}

return item.getLabel(report, value, value / (double) item.getTotal() * 100);
return item.getLabel(report, value, value / (double) model.getItem().getResult().get(id) * 100);
}

public String tooltip(String id, double percentage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
</td>

<j:forEach var="i" items="${row.item.result}">
<td class="text-end">${row.label(i.value)}</td>
<td class="text-end">${row.label(i.key, i.value)}</td>
</j:forEach>

<td>
Expand All @@ -99,8 +99,7 @@
data-bs-toggle="tooltip" data-bs-placement="left"
title="${row.tooltip(id, percentage)}">.</span>
</j:if>



</j:forEach>
</div>
</td>
Expand Down

0 comments on commit fda191c

Please sign in to comment.