From 91b76c85d832086f07171e9d90ae9dfedd344e0d Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 28 Aug 2015 10:54:37 +0800 Subject: [PATCH] * finish task #2313. --- module/project/control.php | 2 +- module/project/model.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/module/project/control.php b/module/project/control.php index 7b6f125ee7..89bd212881 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -737,7 +737,7 @@ class project extends control $baselineJSON = '[]'; $firstBurn = empty($sets) ? 0 : reset($sets); - $firstTime = isset($firstBurn->value) ? $firstBurn->value : 0; + $firstTime = isset($firstBurn->value) ? $firstBurn->value : $this->project->getTotalEstimate($projectInfo->id); $days = count($dateList) - 1; $rate = round($firstTime / $days, 2); $baselineJSON = '['; diff --git a/module/project/model.php b/module/project/model.php index d81da985e0..24f780dc60 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1581,4 +1581,17 @@ class projectModel extends model return array($dateList, $interval); } + + /** + * Get total estimate. + * + * @param int $projectID + * @access public + * @return float + */ + public function getTotalEstimate($projectID) + { + $estimate = $this->dao->select('SUM(estimate) as estimate')->from(TABLE_TASK)->where('deleted')->eq('0')->andWhere('project')->eq($projectID)->fetch('estimate'); + return round($estimate); + } }