Fixes cycle time calculation when the start date is defined in the future

This commit is contained in:
Frederic Guillot
2016-03-22 20:44:15 -04:00
parent 585f734333
commit 8768a4e369
5 changed files with 28 additions and 20 deletions

View File

@@ -85,14 +85,15 @@ class AverageLeadCycleTimeAnalytic extends Base
*/
private function calculateCycleTime(array &$task)
{
if (empty($task['date_started'])) {
return 0;
$end = (int) $task['date_completed'] ?: time();
$start = (int) $task['date_started'];
// Start date can be in the future when defined with the Gantt chart
if ($start > 0 && $end > $start) {
return $end - $start;
}
$end = $task['date_completed'] ?: time();
$start = $task['date_started'];
return $end - $start;
return 0;
}
/**