* [bug] fix error.

This commit is contained in:
qixinzhi
2024-11-07 15:31:30 +08:00
committed by 宋辰轩
parent e5737ff1e0
commit dfbf365aea
3 changed files with 18 additions and 8 deletions
@@ -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'] ++;
}
}
@@ -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] ++;
@@ -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;