Skip to content

Commit 58f0144

Browse files
committed
FIX LoadPerProjCategoryIndicator: wrong pcent
1 parent 4076f83 commit 58f0144

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

plugins/LoadPerProjCategoryIndicator/LoadPerProjCategoryIndicator.class.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ public function setPluginSettings($pluginSettings) {
192192
*/
193193
public function execute() {
194194

195-
196195
// === get timetracks for each Issue,
197196
$team = TeamCache::getInstance()->getTeam($this->teamid);
198197
$useridList = array_keys($team->getActiveMembers($this->startTimestamp, $this->endTimestamp));
@@ -204,7 +203,7 @@ public function execute() {
204203

205204
// === process timetracks
206205
$rawInfoPerCat = $this->getRawInfoPerCategory($timeTracks, $projectidList);
207-
$totalElapsed = $this->inputIssueSel->getElapsed($this->startTimestamp, $this->endTimestamp);
206+
$totalElapsed = $rawInfoPerCat['totalDuration'];
208207

209208
// === build $infoPerCat
210209
$infoPerCat = array();
@@ -289,6 +288,7 @@ private function getRawInfoPerCategory($timeTracks, $projectidList) {
289288
$durPerCat = array();
290289
$bugsPerCat = array();
291290

291+
$totalDuration = 0;
292292
foreach($timeTracks as $timeTrack) {
293293
try {
294294
$bugid = $timeTrack->getIssueId();
@@ -308,6 +308,7 @@ private function getRawInfoPerCategory($timeTracks, $projectidList) {
308308
} else {
309309
$durPerCat[$catName] = $duration;
310310
}
311+
$totalDuration += $duration;
311312

312313
// save bugid list per category
313314
if ($this->isDisplayTasks) {
@@ -325,7 +326,10 @@ private function getRawInfoPerCategory($timeTracks, $projectidList) {
325326
self::$logger->warn("getDurationPerProjectCategory() issue ".$timeTrack->getIssueId()." not found in Mantis DB (duration = ".$timeTrack->getDuration()." on ".date('Y-m-d', $timeTrack->getDate()).')');
326327
}
327328
}
328-
$ret = array('durationPerCat' => $durPerCat);
329+
$ret = array(
330+
'durationPerCat' => $durPerCat,
331+
'totalDuration' => $totalDuration);
332+
329333
if ($this->isDisplayTasks) {
330334
$ret['bugidsPerCat'] = $bugsPerCat;
331335
}

plugins/LoadPerProjCategoryIndicator/LoadPerProjCategoryIndicator_ajax.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
<th>{t}Category{/t}</th>
77
<th>{t}Nb Days{/t}</th>
88
<th>%</th>
9+
{if $loadPerProjCategoryIndicator_isDisplayTasks}
910
<th>{t}Tasks{/t}</th>
11+
{/if}
1012
</tr>
1113
</thead>
1214
<tbody>
@@ -15,7 +17,9 @@
1517
<td>{$i.catName}</td>
1618
<td>{$i.duration}</td>
1719
<td>{$i.pcent} %</td>
20+
{if $loadPerProjCategoryIndicator_isDisplayTasks}
1821
<td>{$i.formatedBugsPerCategory}</td>
22+
{/if}
1923
</tr>
2024
{/foreach}
2125
</tbody>

0 commit comments

Comments
 (0)