From d778a69a90d516239508a38adadb280b4b87adb3 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 16 Nov 2021 17:05:18 +0800 Subject: [PATCH] * Finish task #44354. --- module/report/control.php | 2 +- module/report/model.php | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/module/report/control.php b/module/report/control.php index 4cc2e3322c..984a13d518 100644 --- a/module/report/control.php +++ b/module/report/control.php @@ -115,7 +115,7 @@ class report extends control $this->view->end = $end; $this->view->bugs = $this->report->getBugs($begin, $end, $product, $execution); $this->view->users = $this->loadModel('user')->getPairs('noletter|noclosed|nodeleted'); - $this->view->executions = array('' => '') + $this->loadModel('execution')->getPairs(); + $this->view->executions = array('' => '') + $this->report->getProjectExecutions(); $this->view->products = array('' => '') + $this->loadModel('product')->getPairs(); $this->view->execution = $execution; $this->view->product = $product; diff --git a/module/report/model.php b/module/report/model.php index 8b01517ab1..c446cc5560 100644 --- a/module/report/model.php +++ b/module/report/model.php @@ -1018,6 +1018,42 @@ class reportModel extends model return $overview; } + + /** + * Get project and execution name. + * + * @access public + * @return array + */ + public function getProjectExecutions() + { + $mode = $this->cookie->executionMode; + + $executions = $this->dao->select('t1.id, t1.name, t2.name as projectname, t1.status') + ->from(TABLE_EXECUTION)->alias('t1') + ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id') + ->where('t1.deleted')->eq(0) + ->andWhere('t1.type')->in('stage,sprint') + ->fetchAll(); + $pairs = array(); + foreach($executions as $execution) + { + 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. + $pairs[$execution->id] = $this->config->systemMode == 'new' ? $execution->projectname . '/' .$execution->name : $execution->name; + } + + if(strpos($mode, 'empty') !== false) $pairs[0] = ''; + + /* If the pairs is empty, to make sure there's an execution in the pairs. */ + if(empty($pairs) and isset($executions[0])) + { + $firstExecution = $executions[0]; + $pairs[$firstExecution->id] = $firstExecution->name; + } + + return $pairs; + } } /**