* Finish task#59703,59711
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user