* fix bug for browse testtask.

This commit is contained in:
wangyidong
2017-11-03 15:25:45 +08:00
parent 1ad2a03511
commit 37538538fa
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -99,6 +99,7 @@ class testtaskModel extends model
*/
public function getProductTasks($productID, $branch = 0, $orderBy = 'id_desc', $pager = null, $scopeAndStatus = array(), $beginTime = 0, $endTime = 0)
{
$projects = $this->loadModel('project')->getPairs();
if($this->config->global->flow == 'onlyTest')
{
return $this->dao->select("t1.*, t2.name AS productName, t4.name AS buildName, t4.branch AS branch")
@@ -106,6 +107,7 @@ class testtaskModel extends model
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
->leftJoin(TABLE_BUILD)->alias('t4')->on('t1.build = t4.id')
->where('t1.deleted')->eq(0)
->andWhere('t2.id')->in(array_keys($projects))
->beginIF($scopeAndStatus[0] == 'local')->andWhere('t1.product')->eq((int)$productID)->fi()
->beginIF($scopeAndStatus[1] == 'totalStatus')->andWhere('t1.status')->in(array('blocked','doing','wait','done'))->fi()
->beginIF($scopeAndStatus[1] != 'totalStatus')->andWhere('t1.status')->eq($scopeAndStatus[1])->fi()
@@ -116,7 +118,7 @@ class testtaskModel extends model
}
else
{
$testTask = $this->dao->select("t1.*, t2.name AS productName, t3.name AS projectName, t3.acl, t3.whitelist, t4.name AS buildName, if(t4.name != '', t4.branch, t5.branch) AS branch")
$testTask = $this->dao->select("t1.*, t2.name AS productName, t3.name AS projectName, t4.name AS buildName, if(t4.name != '', t4.branch, t5.branch) AS branch")
->from(TABLE_TESTTASK)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
->leftJoin(TABLE_PROJECT)->alias('t3')->on('t1.project = t3.id')
@@ -125,6 +127,7 @@ class testtaskModel extends model
->where('t1.deleted')->eq(0)
->beginIF($scopeAndStatus[0] == 'local')->andWhere('t1.product')->eq((int)$productID)->fi()
->andWhere('t5.product = t1.product')
->andWhere('t3.id')->in(array_keys($projects))
->beginIF($scopeAndStatus[1] == 'totalStatus')->andWhere('t1.status')->in(array('blocked','doing','wait','done'))->fi()
->beginIF($scopeAndStatus[1] != 'totalStatus')->andWhere('t1.status')->eq($scopeAndStatus[1])->fi()
->beginIF($branch)->andWhere("if(t4.branch, t4.branch, t5.branch) = '$branch'")->fi()