Skip to content

Commit

Permalink
FIX LoadPerProjCategoryIndicator: wrong pcent
Browse files Browse the repository at this point in the history
  • Loading branch information
lbayle committed May 29, 2020
1 parent 4076f83 commit 58f0144
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ public function setPluginSettings($pluginSettings) {
*/
public function execute() {


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

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

// === build $infoPerCat
$infoPerCat = array();
Expand Down Expand Up @@ -289,6 +288,7 @@ private function getRawInfoPerCategory($timeTracks, $projectidList) {
$durPerCat = array();
$bugsPerCat = array();

$totalDuration = 0;
foreach($timeTracks as $timeTrack) {
try {
$bugid = $timeTrack->getIssueId();
Expand All @@ -308,6 +308,7 @@ private function getRawInfoPerCategory($timeTracks, $projectidList) {
} else {
$durPerCat[$catName] = $duration;
}
$totalDuration += $duration;

// save bugid list per category
if ($this->isDisplayTasks) {
Expand All @@ -325,7 +326,10 @@ private function getRawInfoPerCategory($timeTracks, $projectidList) {
self::$logger->warn("getDurationPerProjectCategory() issue ".$timeTrack->getIssueId()." not found in Mantis DB (duration = ".$timeTrack->getDuration()." on ".date('Y-m-d', $timeTrack->getDate()).')');
}
}
$ret = array('durationPerCat' => $durPerCat);
$ret = array(
'durationPerCat' => $durPerCat,
'totalDuration' => $totalDuration);

if ($this->isDisplayTasks) {
$ret['bugidsPerCat'] = $bugsPerCat;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
<th>{t}Category{/t}</th>
<th>{t}Nb Days{/t}</th>
<th>%</th>
{if $loadPerProjCategoryIndicator_isDisplayTasks}
<th>{t}Tasks{/t}</th>
{/if}
</tr>
</thead>
<tbody>
Expand All @@ -15,7 +17,9 @@
<td>{$i.catName}</td>
<td>{$i.duration}</td>
<td>{$i.pcent} %</td>
{if $loadPerProjCategoryIndicator_isDisplayTasks}
<td>{$i.formatedBugsPerCategory}</td>
{/if}
</tr>
{/foreach}
</tbody>
Expand Down

0 comments on commit 58f0144

Please sign in to comment.