* Fix syntax error in tmp log file.
This commit is contained in:
@@ -30,9 +30,9 @@ class day_of_annual_closed_project extends baseCalc
|
||||
{
|
||||
$project = $data->project;
|
||||
$year = substr($data->closedDate, 0, 4);
|
||||
$consumed = $data->consumed;
|
||||
$consumed = (float)$data->consumed;
|
||||
$status = $data->status;
|
||||
$defaultHours = $data->defaultHours;
|
||||
$defaultHours = (float)$data->defaultHours;
|
||||
|
||||
if($status != 'closed') return false;
|
||||
if(empty($year) || $year == '0000') return false;
|
||||
@@ -40,7 +40,7 @@ class day_of_annual_closed_project extends baseCalc
|
||||
if(!isset($this->result[$year])) $this->result[$year] = array();
|
||||
if(!isset($this->result[$year][$project])) $this->result[$year][$project] = 0;
|
||||
|
||||
$this->result[$year][$project] += $defaultHours ? $consumed / $defaultHours : 0;
|
||||
$this->result[$year][$project] += $consumed / $defaultHours;
|
||||
}
|
||||
|
||||
public function getResult($options = array())
|
||||
|
||||
@@ -194,11 +194,11 @@ class metric extends control
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
a($e->getMessage());
|
||||
a($this->metricZen->formatException($e));
|
||||
}
|
||||
catch(Error $e)
|
||||
{
|
||||
a($e->getMessage());
|
||||
a($this->metricZen->formatException($e));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+31
-16
@@ -181,7 +181,10 @@ class metricZen extends metric
|
||||
*/
|
||||
protected function prepareMetricRecord($calcList)
|
||||
{
|
||||
$options = array('year' => date('Y'), 'month' => date('n'), 'week' => substr(date('oW'), -2), 'day' => date('j'));
|
||||
$yesterday = strtotime('-1 day', strtotime('today'));
|
||||
$yesterday = date('j', $yesterday);
|
||||
$today = date('j');
|
||||
$options = array('year' => date('Y'), 'month' => date('n'), 'week' => substr(date('oW'), -2), 'day' => "$today,$yesterday");
|
||||
|
||||
$now = helper::now();
|
||||
$dateValues = $this->metric->generateDateValues($now);
|
||||
@@ -195,24 +198,27 @@ class metricZen extends metric
|
||||
$initRecords = $this->initMetricRecords($recordCommon, $metric->scope);
|
||||
|
||||
$results = $calc->getResult($options);
|
||||
foreach($results as $record)
|
||||
if(is_array($results))
|
||||
{
|
||||
$record = (object)$record;
|
||||
if(empty($record->value)) continue;
|
||||
|
||||
$record->metricID = $calc->id;
|
||||
$record->metricCode = $code;
|
||||
$record->date = $now;
|
||||
$record->system = $metric->scope == 'system' ? 1 : 0;
|
||||
|
||||
$uniqueKey = $this->getUniqueKeyByRecord($record);
|
||||
if(!isset($initRecords[$uniqueKey]))
|
||||
foreach($results as $record)
|
||||
{
|
||||
$initRecords[$uniqueKey] = $record;
|
||||
continue;
|
||||
}
|
||||
$record = (object)$record;
|
||||
if(empty($record->value)) continue;
|
||||
|
||||
$initRecords[$uniqueKey]->value = $record->value;
|
||||
$record->metricID = $calc->id;
|
||||
$record->metricCode = $code;
|
||||
$record->date = $now;
|
||||
$record->system = $metric->scope == 'system' ? 1 : 0;
|
||||
|
||||
$uniqueKey = $this->getUniqueKeyByRecord($record);
|
||||
if(!isset($initRecords[$uniqueKey]))
|
||||
{
|
||||
$initRecords[$uniqueKey] = $record;
|
||||
continue;
|
||||
}
|
||||
|
||||
$initRecords[$uniqueKey]->value = $record->value;
|
||||
}
|
||||
}
|
||||
|
||||
$records[$code] = array_values($initRecords);
|
||||
@@ -496,6 +502,15 @@ class metricZen extends metric
|
||||
return ($tableWidth > 300) ? '' : 'shortPageSize';
|
||||
}
|
||||
|
||||
public function formatException($e)
|
||||
{
|
||||
$message = $e->getMessage();
|
||||
$line = $e->getLine();
|
||||
$file = $e->getFile();
|
||||
|
||||
return "Error: $message in $file on line $line";
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据后台配置的估算单位对列表赋值。
|
||||
* Assign unitList['measure'] by custom hourPoint.
|
||||
|
||||
@@ -2077,7 +2077,7 @@ class screenModel extends model
|
||||
else
|
||||
{
|
||||
$setting = json_decode($chart->settings, true)[0];
|
||||
$options = $this->loadModel('chart')->genWaterPolo(json_decode($chart->fieldSettings, true), $setting, $chart->sql, $filters);
|
||||
$options = $this->loadModel('chart')->genWaterPolo(json_decode($chart->fields, true), $setting, $chart->sql, $filters);
|
||||
|
||||
$component->option->dataset = $options['series'][0]['data'][0];
|
||||
return $this->setComponentDefaults($component);
|
||||
@@ -2956,7 +2956,8 @@ class screenModel extends model
|
||||
->andWhere('month(t2.closedDate)')->eq($month)
|
||||
->fetchPairs();
|
||||
|
||||
$deliveredStoryCount = count(array_merge($finishedStoryList, (array)$releasedStoryGroups[$productID]));
|
||||
$releasedStoryList = isset($releasedStoryGroups[$productID]) ? $releasedStoryGroups[$productID] : array();
|
||||
$deliveredStoryCount = count(array_merge($finishedStoryList, (array)$releasedStoryList));
|
||||
|
||||
$row = new stdclass();
|
||||
$row->id = $productID;
|
||||
@@ -3035,7 +3036,8 @@ class screenModel extends model
|
||||
->andWhere('month(t3.closedDate)')->eq($month)
|
||||
->fetchPairs();
|
||||
|
||||
$deliveredStoryCount = count(array_merge($finishedStoryList, (array)$releasedStoryGroups[$projectID]));
|
||||
$releasedStoryList = isset($releasedStoryGroups[$projectID]) ? $releasedStoryGroups[$projectID] : array();
|
||||
$deliveredStoryCount = count(array_merge($finishedStoryList, (array)$releasedStoryList));
|
||||
|
||||
$row = new stdclass();
|
||||
$row->id = $projectID;
|
||||
|
||||
Reference in New Issue
Block a user