diff --git a/module/metric/calc/execution/rate/rate_of_finished_test_task_in_execution_when_closing.php b/module/metric/calc/execution/rate/rate_of_finished_test_task_in_execution_when_closing.php index 1ed23d2d75..3223a2c444 100644 --- a/module/metric/calc/execution/rate/rate_of_finished_test_task_in_execution_when_closing.php +++ b/module/metric/calc/execution/rate/rate_of_finished_test_task_in_execution_when_closing.php @@ -22,7 +22,7 @@ class rate_of_finished_test_task_in_execution_when_closing extends baseCalc { public $dataset = 'getTasks'; - public $fieldList = array('t1.type', 't1.status', 't1.closedReason', 't1.closedDate', 't1.execution', "if(t2.multiple = '1', t2.closedDate, t3.closedDate) as executionClosed"); + public $fieldList = array('t1.type', 't1.status', 't1.closedReason', 't1.closedDate', 't1.execution', 't2.multiple', 't2.closedDate as executionClosed', 't3.closedDate as projectClosed'); public $result = array(); @@ -30,11 +30,20 @@ class rate_of_finished_test_task_in_execution_when_closing extends baseCalc public function calculate($row) { - if(!helper::isZeroDate($row->executionClosed)) + $executionClosed = $row->multiple == '1' ? $row->executionClosed : $row->projectClosed; + if(!helper::isZeroDate($executionClosed)) { - if(!isset($this->result[$row->execution])) $this->result[$row->execution] = array('finished' => 0, 'total' => 0); - if($row->type == 'test' && ($row->status == 'done' || ($row->status == 'closed' && $row->closedReason == 'done')) && !empty($row->executionClosed) && date('Y-m-d', strtotime($row->closedDate)) <= $row->executionClosed) $this->result[$row->execution]['finished'] ++; - if($row->type == 'test') $this->result[$row->execution]['total'] ++; + if($row->type !== 'test') return; + + $execution = $row->execution; + $status = $row->status; + $closedReason = $row->closedReason; + $closedDate = $row->closedDate; + if($closedDate) $closedDate = date('Y-m-d', strtotime($closedDate)); + + if(!isset($this->result[$execution])) $this->result[$execution] = array('finished' => 0, 'total' => 0); + if(($status == 'done' || ($status == 'closed' && $closedReason == 'done')) && $closedDate && $closedDate <= $executionClosed) $this->result[$execution]['finished'] ++; + $this->result[$execution]['total'] ++; } } diff --git a/module/metric/calc/execution/scale/count_of_finished_test_task_in_execution_when_closing.php b/module/metric/calc/execution/scale/count_of_finished_test_task_in_execution_when_closing.php index 2473f87132..e305bb81ec 100755 --- a/module/metric/calc/execution/scale/count_of_finished_test_task_in_execution_when_closing.php +++ b/module/metric/calc/execution/scale/count_of_finished_test_task_in_execution_when_closing.php @@ -22,7 +22,7 @@ class count_of_finished_test_task_in_execution_when_closing extends baseCalc { public $dataset = 'getTasks'; - public $fieldList = array('t1.type', 't1.status', 't1.closedReason', "IF(t1.finishedDate, t1.finishedDate, t1.closedDate) AS finishedDate", 't1.execution', 't2.closedDate AS executionClosedDate'); + public $fieldList = array('t1.type', 't1.status', 't1.closedReason', 't1.finishedDate', 't1.closedDate', 't1.execution', 't2.closedDate AS executionClosedDate'); public $result = array(); @@ -30,9 +30,10 @@ class count_of_finished_test_task_in_execution_when_closing extends baseCalc public function calculate($row) { + $finishedDate = $this->isDate($row->finishedDate) ? $row->finishedDate : $row->closedDate; if(!helper::isZeroDate($row->executionClosedDate)) { - if($row->type == 'test' && ($row->status == 'done' || $row->status == 'closed' && $row->closedReason == 'done') && $row->finishedDate <= $row->executionClosedDate) + if($row->type == 'test' && ($row->status == 'done' || $row->status == 'closed' && $row->closedReason == 'done') && $finishedDate <= $row->executionClosedDate) { if(!isset($this->result[$row->execution])) $this->result[$row->execution] = 0; $this->result[$row->execution] ++; diff --git a/module/metric/calc/product/scale/count_of_annual_created_productplan_in_product.php b/module/metric/calc/product/scale/count_of_annual_created_productplan_in_product.php index e020a73c17..fb8517b6b1 100755 --- a/module/metric/calc/product/scale/count_of_annual_created_productplan_in_product.php +++ b/module/metric/calc/product/scale/count_of_annual_created_productplan_in_product.php @@ -28,7 +28,7 @@ class count_of_annual_created_productplan_in_product extends baseCalc public function calculate($row) { - if(empty(trim($row->createdDate))) return false; + if(!$this->isDate($row->createdDate)) return false; $row->year = $this->getYear($row->createdDate); if(!$row->year) return false;