* Finish task#59703,59711

This commit is contained in:
zenggang
2022-07-06 06:42:19 +00:00
parent 1653df17fd
commit 8773257051
12 changed files with 96 additions and 4 deletions
+41 -3
View File
@@ -3094,8 +3094,8 @@ class executionModel extends model
/**
* Get begin and end for CFD.
*
* @param object $execution
*
* @param object $execution
* @access public
* @return void
*/
@@ -3236,7 +3236,7 @@ class executionModel extends model
/**
* Build CFD data.
*
*
* @param int $executionID
* @param string $type
* @param array $dateList
@@ -3294,6 +3294,44 @@ class executionModel extends model
return $data;
}
/**
* Get CFD statistics.
*
* @param int $executionID
* @param array $dateList
* @param string $type
* @access public
* @return void
*/
public function getCFDStatistics($executionID, $dateList, $type)
{
$kanbanData = $this->loadModel('kanban')->getRDKanban($executionID, $type);
$kanbanData = array_shift($kanbanData);
$cycleTime = array();
foreach($kanbanData->groups as $group)
{
foreach($group->lanes as $lane)
{
if(!isset($lane->items['closed'])) continue;
foreach($lane->items['closed'] as $item)
{
$diffTime = $type == 'story' ? strtotime($item['lastEditedDate']) - strtotime($item['openedDate']) : strtotime($item['closedDate']) - strtotime($item['openedDate']);
$day = floor($diffTime / (3600 * 24));
if($day > 0) $cycleTime[$item['id']] = $day;
}
}
}
$itemCount = count($cycleTime);
if(!$itemCount) return array('', '');
$cycleTimeAvg = round(array_sum($cycleTime) / $itemCount);
$throughput = round(($itemCount * 7) / $cycleTimeAvg, 1) . "{$this->lang->execution->kanbanCardsUnit}/" . $this->lang->execution->week;
return array($cycleTimeAvg, $throughput);
}
/**
* Get taskes by search.
*