* Add getExecutionCounts method.
This commit is contained in:
@@ -1857,6 +1857,35 @@ class executionModel extends model
|
||||
->fetchPairs('id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get execution count.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $browseType all|undone|wait|doing|suspended|closed|involved|review
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getExecutionCounts($projectID = 0, $browseType = 'all')
|
||||
{
|
||||
$executions = $this->dao->select('t1.*,t2.name projectName, t2.model as projectModel')->from(TABLE_EXECUTION)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
|
||||
->where('t1.type')->in('sprint,stage,kanban')
|
||||
->andWhere('t1.deleted')->eq('0')
|
||||
->andWhere('t1.vision')->eq($this->config->vision)
|
||||
->andWhere('t1.multiple')->eq('1')
|
||||
->beginIF(!$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->sprints)->fi()
|
||||
->beginIF($projectID)->andWhere('t1.project')->eq($projectID)->fi()
|
||||
->beginIF(!in_array($browseType, array('all', 'undone', 'involved', 'review', 'bySearch')))->andWhere('t1.status')->eq($browseType)->fi()
|
||||
->beginIF($browseType == 'undone')->andWhere('t1.status')->notIN('done,closed')->fi()
|
||||
->beginIF($browseType == 'review')
|
||||
->andWhere("FIND_IN_SET('{$this->app->user->account}', t1.reviewers)")
|
||||
->andWhere('t1.reviewStatus')->eq('doing')
|
||||
->fi()
|
||||
->fetchAll('id');
|
||||
|
||||
return count($executions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get execution stat data.
|
||||
|
||||
@@ -1868,11 +1897,10 @@ class executionModel extends model
|
||||
* @param string|int $param skipParent
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @param bool $isCount true for count, false for fetchAll.
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStatData($projectID = 0, $browseType = 'undone', $productID = 0, $branch = 0, $withTasks = false, $param = '', $orderBy = 'id_asc', $pager = null, $isCount = false)
|
||||
public function getStatData($projectID = 0, $browseType = 'undone', $productID = 0, $branch = 0, $withTasks = false, $param = '', $orderBy = 'id_asc', $pager = null)
|
||||
{
|
||||
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getExecutionStats($browseType);
|
||||
|
||||
@@ -1910,7 +1938,7 @@ class executionModel extends model
|
||||
->andWhere('t1.multiple')->eq('1')
|
||||
->beginIF(!$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->sprints)->fi()
|
||||
->beginIF(!empty($executionQuery))->andWhere($executionQuery)->fi()
|
||||
->beginIF($productID)->andWhere('t3.product')->eq((int)$productID)->fi()
|
||||
->beginIF($productID)->andWhere('t3.product')->eq($productID)->fi()
|
||||
->beginIF($projectID)->andWhere('t1.project')->eq($projectID)->fi()
|
||||
->beginIF(!in_array($browseType, array('all', 'undone', 'involved', 'review', 'bySearch')))->andWhere('t1.status')->eq($browseType)->fi()
|
||||
->beginIF($browseType == 'undone')->andWhere('t1.status')->notIN('done,closed')->fi()
|
||||
@@ -1922,8 +1950,6 @@ class executionModel extends model
|
||||
->page($pager, 't1.id')
|
||||
->fetchAll('id');
|
||||
|
||||
if($isCount) return count($executions);
|
||||
|
||||
if(empty($productID) and !empty($executions)) $projectProductIdList = $this->dao->select('project, GROUP_CONCAT(product) as product')->from(TABLE_PROJECTPRODUCT)->where('project')->in(array_keys($executions))->groupBy('project')->fetchPairs();
|
||||
|
||||
$hours = $this->loadModel('project')->computerProgress($executions);
|
||||
|
||||
Reference in New Issue
Block a user