From db18b9b3e95074492060331e71efd35098c3075b Mon Sep 17 00:00:00 2001 From: leiyong <1549684884@qq.com> Date: Thu, 24 Dec 2020 22:16:49 +0800 Subject: [PATCH] * Finish task#8781. --- module/issue/model.php | 1 + module/risk/model.php | 3 ++- module/testtask/model.php | 30 ++++++++++++++++++++++++++++++ module/todo/model.php | 10 +++++++--- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/module/issue/model.php b/module/issue/model.php index cef1cef0c5..1cc0be7a13 100644 --- a/module/issue/model.php +++ b/module/issue/model.php @@ -198,6 +198,7 @@ class issueModel extends model ->where('t1.assignedTo')->eq($account) ->andWhere('t1.deleted')->eq(0) ->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi() + ->limit($limit) ->query(); $issues = array(); diff --git a/module/risk/model.php b/module/risk/model.php index 4da4241136..e440bb17d6 100644 --- a/module/risk/model.php +++ b/module/risk/model.php @@ -260,7 +260,7 @@ class riskModel extends model * * @param string $account * @param int $limit - * @param string $status active|closed|hangup|canceled + * @param string $status all|active|closed|hangup|canceled * @access public * @return array */ @@ -272,6 +272,7 @@ class riskModel extends model ->where('t1.assignedTo')->eq($account) ->andWhere('t1.deleted')->eq(0) ->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi() + ->limit($limit) ->query(); $risks = array(); diff --git a/module/testtask/model.php b/module/testtask/model.php index aafe4a3e82..5d3b0bff52 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -1079,6 +1079,36 @@ class testtaskModel extends model return $runs; } + /** + * Get testtask pairs of a user. + * + * @param string $account + * @param int $limit + * @param string $status all|wait|doing|done|blocked + * @param string $skipProjectIDList + * @access public + * @return array + */ + public function getUserTesttaskPairs($account, $limit = 10, $status = 'all', $skipProjectIDList = '') + { + $stmt = $this->dao->select('t1.id, t1.name, t2.name as project') + ->from(TABLE_TESTTASK)->alias('t1') + ->leftjoin(TABLE_PROJECT)->alias('t2')->on('t1.PRJ = t2.id') + ->where('t1.owner')->eq($account) + ->andWhere('t1.deleted')->eq(0) + ->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi() + ->beginIF(!empty($skipProjectIDList))->andWhere('t1.project')->notin($skipProjectIDList)->fi() + ->limit($limit) + ->query(); + + $testtaskPairs = array(); + while($testtask = $stmt->fetch()) + { + $testtaskPairs[$testtask->id] = $testtask->project . ' / ' . $testtask->name; + } + return $testtaskPairs; + } + /** * Get info of a test run. * diff --git a/module/todo/model.php b/module/todo/model.php index a2fc6d412e..c0165d6a2e 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -352,9 +352,13 @@ class todoModel extends model if(!$todo) return false; $todo = $this->loadModel('file')->replaceImgURL($todo, 'desc'); if($setImgSize) $todo->desc = $this->file->setImgSize($todo->desc); - if($todo->type == 'story') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_STORY)->fetch('title'); - if($todo->type == 'task') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TASK)->fetch('name'); - if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_BUG)->fetch('title'); + if($todo->type == 'story') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_STORY)->fetch('title'); + if($todo->type == 'task') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TASK)->fetch('name'); + if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_BUG)->fetch('title'); + if($todo->type == 'issue') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_ISSUE)->fetch('title'); + if($todo->type == 'risk') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_RISK)->fetch('name'); + if($todo->type == 'review') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_REVIEW)->fetch('title'); + if($todo->type == 'testtask') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TESTTASK)->fetch('name'); $todo->date = str_replace('-', '', $todo->date); return $todo; }