* Change the parameters passed by the method.
This commit is contained in:
@@ -256,7 +256,7 @@ class projectModel extends model
|
||||
/* Get team members and estimates under the project. */
|
||||
$projectIdList = array_keys($projects);
|
||||
$teamCount = $this->projectTao->fetchMemberCountByIdList($projectIdList);
|
||||
$estimates = $this->projectTao->fetchTaskEstimateByIdList($projectIdList);
|
||||
$estimates = $this->projectTao->fetchTaskEstimateByIdList($projectIdList, 'estimate');
|
||||
|
||||
/* Set project attribute. */
|
||||
$this->app->loadClass('pager', true);
|
||||
@@ -294,8 +294,7 @@ class projectModel extends model
|
||||
$teamCount = $this->projectTao->fetchMemberCountByIdList($projectIdList);
|
||||
|
||||
/* Get all consumed and all estimate under the project. */
|
||||
$fields = 't2.project, ROUND(SUM(t1.consumed), 1) AS consumed, ROUND(SUM(t1.estimate), 1) AS estimate';
|
||||
$hours = $this->projectTao->fetchTaskEstimateByIdList($projectIdList, $fields);
|
||||
$hours = $this->projectTao->fetchTaskEstimateByIdList($projectIdList, 'consumed,estimate');
|
||||
|
||||
/* Get bug, task and story summary under the project. */
|
||||
$bugSummary = $this->projectTao->getTotalBugByProject($projectIdList);
|
||||
|
||||
@@ -737,9 +737,13 @@ class projectTao extends projectModel
|
||||
* @access protected
|
||||
* @return array
|
||||
*/
|
||||
protected function fetchTaskEstimateByIdList(array $projectIdList, string $fields = 't2.project as project, sum(estimate) as estimate'): array
|
||||
protected function fetchTaskEstimateByIdList(array $projectIdList, string $fields = 'estimate'): array
|
||||
{
|
||||
return $this->dao->select($fields)->from(TABLE_TASK)->alias('t1')
|
||||
$fields = explode(',', $fields);
|
||||
$selectFields = 't2.project';
|
||||
foreach($fields as $field) $selectFields .= ", ROUND(SUM(t1.{$field}), 1) AS {$field}";
|
||||
|
||||
return $this->dao->select($selectFields)->from(TABLE_TASK)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.execution = t2.id')
|
||||
->where('t1.parent')->lt(1)
|
||||
->andWhere('t2.project')->in($projectIdList)
|
||||
|
||||
Reference in New Issue
Block a user