diff --git a/module/metric/calc/project/scale/count_of_delayed_execution_in_project.php b/module/metric/calc/project/scale/count_of_delayed_execution_in_project.php index 151c52476b..70d1c264f5 100755 --- a/module/metric/calc/project/scale/count_of_delayed_execution_in_project.php +++ b/module/metric/calc/project/scale/count_of_delayed_execution_in_project.php @@ -7,6 +7,20 @@ class count_of_delayed_execution_in_project extends baseCalc public $result = array(); + public function calculate($row) + { + $project = $row->project; + $nowDate = helper::now(); + $end = $row->end; + $year = $this->getYear($end); + if(!$year) return false; + + $nextDate = date('Y-m-d', strtotime($end . ' +1 day')); + if(strtotime($nowDate) <= strtotime($nextDate)) return false; + if(!isset($this->result[$project])) $this->result[$project] = 0; + $this->result[$project] += 1; + } + public function getResult($options = array()) { $records = $this->getRecords(array('project', 'value'));