* [refac] add config to filter metric by edition.
This commit is contained in:
@@ -6,8 +6,11 @@ $config->metric->purposeList = array('scale', 'qc', 'hour', 'cost', 'rate', 't
|
||||
$config->metric->dateList = array('year', 'month', 'week', 'day');
|
||||
$config->metric->excludeGlobal = array('program', 'project', 'product', 'execution', 'user');
|
||||
$config->metric->orMetricList = array('count_of_assigned_demand_in_user');
|
||||
$config->metric->maxSelectNum = 10;
|
||||
|
||||
$config->metric->maxSelectNum = 10;
|
||||
$config->metric->excludeDatasetList = array();
|
||||
$config->metric->excludeDatasetList['open'] = array('getFeedbacks', 'getTickets', 'getIssues', 'getRisks', 'getDemands', 'getQAs');
|
||||
$config->metric->excludeDatasetList['biz'] = array('getIssues', 'getRisks', 'getDemands', 'getQAs');
|
||||
|
||||
$config->metric->collapseList = array('codebase', 'pipeline', 'artifact', 'deployment', 'node', 'application', 'cpu', 'memory', 'commit', 'mergeRequest', 'code', 'vulnerability', 'codeAnalysis');
|
||||
if(in_array($config->edition, array('max', 'ipd'))) $config->metric->collapseList = array_merge($config->metric->collapseList, array('risk', 'issue'));
|
||||
|
||||
+16
-1
@@ -1141,7 +1141,7 @@ class metricModel extends model
|
||||
$calcInstances[$className] = $metricInstance;
|
||||
}
|
||||
|
||||
return $calcInstances;
|
||||
return $this->filterCalcByEdition($calcInstances);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2750,4 +2750,19 @@ class metricModel extends model
|
||||
->limit(1)
|
||||
->fetch('date');
|
||||
}
|
||||
|
||||
public function filterCalcByEdition($calcInstances)
|
||||
{
|
||||
foreach($calcInstances as $code => $instance)
|
||||
{
|
||||
$excludeDatasetConfig = $this->config->metric->excludeDatasetList;
|
||||
if(!empty($instance->dataset) && !empty($excludeDatasetConfig[$this->config->edition]))
|
||||
{
|
||||
$excludeDatasetList = $excludeDatasetConfig[$this->config->edition];
|
||||
if(in_array($instance->dataset, $excludeDatasetList)) unset($calcInstances[$code]);
|
||||
}
|
||||
}
|
||||
|
||||
return $calcInstances;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,9 +182,6 @@ class metricZen extends metric
|
||||
{
|
||||
foreach($classifiedCalcGroup as $calcGroup)
|
||||
{
|
||||
if($this->config->edition == 'open' && in_array($calcGroup->dataset, array('getFeedbacks', 'getTickets', 'getIssues', 'getRisks', 'getDemands', 'getQAs'))) continue;
|
||||
if($this->config->edition == 'biz' && in_array($calcGroup->dataset, array('getIssues', 'getRisks', 'getDemands', 'getQAs'))) continue;
|
||||
|
||||
try
|
||||
{
|
||||
$statement = $this->prepareDataset($calcGroup);
|
||||
|
||||
Reference in New Issue
Block a user