* Finish task #83938.

This commit is contained in:
zhujinyong
2023-02-07 11:06:24 +08:00
parent 61d36f2fcb
commit 26c0c5e9dc
2 changed files with 23 additions and 5 deletions
+3 -3
View File
@@ -72,7 +72,7 @@ class build extends control
if($this->app->tab == 'project')
{
$this->project->setMenu($projectID);
$executions = $this->execution->getPairs($projectID, 'all', 'stagefilter');
$executions = $this->execution->getPairs($projectID, 'all', 'stagefilter|leaf');
$executionID = empty($executionID) ? key($executions) : $executionID;
$productGroups = $executionID ? $this->product->getProducts($executionID) : array();
$branchGroups = $executionID ? $this->project->getBranchesByProject($executionID) : array();
@@ -81,7 +81,7 @@ class build extends control
elseif($this->app->tab == 'execution')
{
$execution = $this->execution->getByID($executionID);
$executions = $this->execution->getPairs($execution->project);
$executions = $this->execution->getPairs($execution->project, 'all', 'leaf');
$projectID = $execution->project;
$productGroups = $this->product->getProducts($executionID);
$branchGroups = $this->project->getBranchesByProject($executionID);
@@ -92,7 +92,7 @@ class build extends control
{
$execution = $this->execution->getByID($executionID);
$projectID = $execution ? $execution->project : 0;
$executions = $this->execution->getPairs($projectID);
$executions = $this->execution->getPairs($projectID, 'all', 'leaf');
$productGroups = $this->product->getProducts($executionID);
$branchGroups = $this->project->getBranchesByProject($executionID);
}
+20 -2
View File
@@ -1287,7 +1287,7 @@ class executionModel extends model
*
* @param int $projectID
* @param string $type all|sprint|stage|kanban
* @param string $mode all|noclosed|stagefilter|withdelete|multiple or empty
* @param string $mode all|noclosed|stagefilter|withdelete|multiple|leaf or empty
* @access public
* @return array
*/
@@ -1324,16 +1324,34 @@ class executionModel extends model
->orderBy($orderBy)
->fetchAll();
/* If mode == leaf, only show leaf executions. */
$allExecutions = $this->dao->select('id,name,parent')->from(TABLE_EXECUTION)
->where('type')->notin(array('program', 'project'))
->beginIf($projectId)->andWhere('project')->eq($projectID)->fi()
->fetchAll('id');
$parents = array();
foreach($allExecutions as $exec)
{
$parents[$exec->parent] = true;
}
$pairs = array();
$noMultiples = array();
foreach($executions as $execution)
{
if(strpos($mode, 'leaf') !== false and isset($parents[$execution->id])) continue; // Only show leaf.
if(strpos($mode, 'noclosed') !== false and ($execution->status == 'done' or $execution->status == 'closed')) continue;
if(strpos($mode, 'stagefilter') !== false and isset($executionModel) and $executionModel == 'waterfall' and in_array($execution->attribute, array('request', 'design', 'review'))) continue; // Some stages of waterfall not need.
if(empty($execution->multiple)) $noMultiples[$execution->id] = $execution->project;
$pairs[$execution->id] = $execution->name;
/* Set execution name. */
$paths = array_slice(explode(',', trim($execution->path, ',')), 1);
$executionName = '';
foreach($paths as $path) $executionName .= '/' . $allExecutions[$path]->name;
$pairs[$execution->id] = $executionName;
}
if($noMultiples)