* Change the parameters passed by the method.

This commit is contained in:
caoyanyi
2023-05-11 14:54:20 +08:00
parent e5b2db5fbc
commit 6f6eabeaae
2 changed files with 8 additions and 5 deletions
+2 -3
View File
@@ -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);
+6 -2
View File
@@ -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)