* [task#124866,done,0.5h] implement metric calc.

This commit is contained in:
zhouxin
2024-08-08 16:15:13 +08:00
committed by 宋辰轩
parent 80629c7311
commit 2a9ede995e
@@ -18,3 +18,23 @@
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @Link https://www.zentao.net
*/
class count_of_case_expect_in_execution extends baseCalc
{
public $dataset = 'getExecutionCasesSteps';
public $fieldList = array('t2.project as execution', 't1.expect');
public $result = array();
public function calculate($row)
{
if(empty($row->expect)) return;
if(!isset($this->result[$row->execution])) $this->result[$row->execution] = 0;
$this->result[$row->execution] += 1;
}
public function getResult($options = array())
{
return $this->filterByOptions($this->getRecords(array('execution', 'value')), $options);
}
}