* Fix execution metric.

This commit is contained in:
qixinzhi
2023-09-26 06:01:40 +00:00
parent 5b0174fa79
commit b227e0f386
5 changed files with 24 additions and 24 deletions
@@ -30,27 +30,27 @@ class rate_of_finished_story_in_execution extends baseCalc
public function calculate($row)
{
$project = $row->project;
$execution = $row->project;
$closedReason = $row->closedReason;
if(!isset($this->result[$project]))
if(!isset($this->result[$execution]))
{
$this->result[$project]['finished'] = 0;
$this->result[$project]['valid'] = 0;
$this->result[$execution]['finished'] = 0;
$this->result[$execution]['valid'] = 0;
}
if($closedReason == 'done') $this->result[$project]['finished'] += 1;
if(!in_array($row->closedReason, array('duplicate','willnotdo','bydesign'))) $this->result[$project]['valid'] += 1;
if($closedReason == 'done') $this->result[$execution]['finished'] += 1;
if(!in_array($row->closedReason, array('duplicate','willnotdo','bydesign'))) $this->result[$execution]['valid'] += 1;
}
public function getResult($options = array())
{
$records = array();
foreach($this->result as $project => $value)
foreach($this->result as $execution => $value)
{
$finished = $value['finished'];
$valid = $value['valid'];
$ratio = $valid == 0 ? 0 : round($finished / $valid, 4);
$records[] = array('project' => $project, 'value' => $ratio);
$records[] = array('execution' => $execution, 'value' => $ratio);
}
return $this->filterByOptions($records, $options);
}
@@ -30,14 +30,14 @@ class count_of_finished_story_in_execution extends baseCalc
public function calculate($row)
{
$project = $row->project;
if(!isset($this->result[$project])) $this->result[$project] = 0;
if($row->closedReason == 'done') $this->result[$project] += 1;
$execution = $row->project;
if(!isset($this->result[$execution])) $this->result[$execution] = 0;
if($row->closedReason == 'done') $this->result[$execution] += 1;
}
public function getResult($options = array())
{
$records = $this->getRecords(array('project', 'value'));
$records = $this->getRecords(array('execution', 'value'));
return $this->filterByOptions($records, $options);
}
}
@@ -30,14 +30,14 @@ class count_of_invalid_story_in_execution extends baseCalc
public function calculate($row)
{
$project = $row->project;
if(!isset($this->result[$project])) $this->result[$project] = 0;
if(in_array($row->closedReason, array('duplicate','willnotdo','bydesign'))) $this->result[$project] += 1;
$execution = $row->project;
if(!isset($this->result[$execution])) $this->result[$execution] = 0;
if(in_array($row->closedReason, array('duplicate','willnotdo','bydesign'))) $this->result[$execution] += 1;
}
public function getResult($options = array())
{
$records = $this->getRecords(array('project', 'value'));
$records = $this->getRecords(array('execution', 'value'));
return $this->filterByOptions($records, $options);
}
}
@@ -30,14 +30,14 @@ class count_of_story_in_execution extends baseCalc
public function calculate($row)
{
$project = $row->project;
if(!isset($this->result[$project])) $this->result[$project] = 0;
$this->result[$project] += 1;
$execution = $row->project;
if(!isset($this->result[$execution])) $this->result[$execution] = 0;
$this->result[$execution] += 1;
}
public function getResult($options = array())
{
$records = $this->getRecords(array('project', 'value'));
$records = $this->getRecords(array('execution', 'value'));
return $this->filterByOptions($records, $options);
}
}
@@ -30,14 +30,14 @@ class count_of_valid_story_in_execution extends baseCalc
public function calculate($row)
{
$project = $row->project;
if(!isset($this->result[$project])) $this->result[$project] = 0;
if(!in_array($row->closedReason, array('duplicate','willnotdo','bydesign'))) $this->result[$project] += 1;
$execution = $row->project;
if(!isset($this->result[$execution])) $this->result[$execution] = 0;
if(!in_array($row->closedReason, array('duplicate','willnotdo','bydesign'))) $this->result[$execution] += 1;
}
public function getResult($options = array())
{
$records = $this->getRecords(array('project', 'value'));
$records = $this->getRecords(array('execution', 'value'));
return $this->filterByOptions($records, $options);
}
}