diff --git a/module/bug/model.php b/module/bug/model.php index 83f7e034e1..edcd49377e 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -337,19 +337,9 @@ class bugModel extends model /* Get bugs by browse type. */ $bugList = array(); - if($browseType == 'all') - { - $bugList = $this->bugTao->getAllBugs($productIdList, $projectID, $executionIdList, $branch, $modules, $orderBy, $pager); - $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'bug'); - } - elseif($browseType == 'review') - { - $bugList = $this->bugTao->getListByReviewToMe($productIdList, $projectID, $executionIdList, $branch, $modules, $orderBy, $pager); - $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'bug'); - } + if($browseType == 'bysearch') $bugList = $this->getBySearch($productIdList, $branch, $queryID, $orderBy, '', $pager, $projectID); elseif($browseType == 'needconfirm') $bugList = $this->bugTao->getListByNeedconfirm($productIdList, $projectID, $executionIdList, $branch, $modules, $orderBy, $pager); - elseif($browseType == 'bysearch') $bugList = $this->getBySearch($productIdList, $branch, $queryID, $orderBy, '', $pager, $projectID); - elseif(strpos(',bymodule,assigntome,openedbyme,resolvedbyme,assigntonull,unconfirmed,unresolved,unclosed,toclosed,longlifebugs,postponedbugs,overduebugs,assignedbyme,', ",$browseType,") !== false) $bugList = $this->bugTao->getListByBrowseType($browseType, $productIdList, $projectID, $executionIdList, $branch, $modules, $orderBy, $pager); + elseif(strpos(',all,bymodule,assigntome,openedbyme,resolvedbyme,assigntonull,unconfirmed,unresolved,unclosed,toclosed,longlifebugs,postponedbugs,overduebugs,assignedbyme,review,', ",$browseType,") !== false) $bugList = $this->bugTao->getListByBrowseType($browseType, $productIdList, $projectID, $executionIdList, $branch, $modules, $orderBy, $pager); return $this->bugTao->batchAppendDelayedDays($bugList); } diff --git a/module/bug/tao.php b/module/bug/tao.php index eb77edfa7a..90cdfdac7a 100644 --- a/module/bug/tao.php +++ b/module/bug/tao.php @@ -21,36 +21,6 @@ class bugTao extends bugModel ->where('t1.id')->eq((int)$bugID)->fetch(); } - /** - * Get all bugs. - * 获取所有的bug。 - * - * @param int|array $productIdList - * @param int|string $branch - * @param int|array $moduleIdList - * @param int[] $executionIdList - * @param string $orderBy - * @param object $pager - * @param int $projectID - * @access protected - * @return array - */ - protected function getAllBugs(int|array $productIdList, int $projectID, array $executionIdList, int|string $branch, int|array $moduleIdList, string $orderBy, object $pager = null): array - { - return $this->dao->select("t1.*, t2.title as planTitle, IF(t1.`pri` = 0, {$this->config->maxPriValue}, t1.`pri`) as priOrder, IF(t1.`severity` = 0, {$this->config->maxPriValue}, t1.`severity`) as severityOrder")->from(TABLE_BUG)->alias('t1') - ->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id') - ->where('t1.deleted')->eq('0') - ->andWhere('t1.product')->in($productIdList) - ->beginIF($projectID)->andWhere('t1.project')->eq($projectID)->fi() - ->beginIF($this->app->tab !== 'qa')->andWhere('t1.execution')->in($executionIdList)->fi() - ->beginIF($branch !== 'all')->andWhere('t1.branch')->eq($branch)->fi() - ->beginIF($moduleIdList)->andWhere('t1.module')->in($moduleIdList)->fi() - ->beginIF(!$this->app->user->admin)->andWhere('t1.project')->in('0,' . $this->app->user->view->projects)->fi() - ->orderBy($orderBy) - ->page($pager) - ->fetchAll('id'); - } - /** * Get bug list by browse type. * 通过浏览类型获取bug列表。 @@ -100,6 +70,7 @@ class bugTao extends bugModel ->beginIF($browseType == 'unresolved')->andWhere('status')->eq('active')->fi() ->beginIF($browseType == 'toclosed')->andWhere('status')->eq('resolved')->fi() ->beginIF($browseType == 'postponedbugs')->andWhere('resolution')->eq('postponed')->fi() + ->beginIF($browseType == 'review')->andWhere("FIND_IN_SET('{$this->app->user->account}', reviewers)")->fi() ->beginIF($browseType == 'longlifebugs') ->andWhere('lastEditedDate')->lt($lastEditedDate) @@ -121,6 +92,7 @@ class bugTao extends bugModel ->page($pager) ->fetchAll('id'); + $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'bug'); return $bugList; } @@ -156,37 +128,6 @@ class bugTao extends bugModel ->fetchAll('id'); } - /** - * Get bug list to review. - * 获取待我审批的bug列表。 - * - * @param int|array $productIdList - * @param int $projectID - * @param int[] $executionIdList - * @param int|string $branch - * @param int|array $moduleIdList - * @param string $orderBy - * @param object $pager - * @access public - * @return array - */ - protected function getListByReviewToMe(int|array $productIdList, int $projectID, array $executionIdList, int|string $branch, int|array $moduleIdList, string $orderBy, object $pager = null): array - { - return $this->dao->select("t1.*, t2.title as planTitle, IF(`pri` = 0, {$this->config->maxPriValue}, `pri`) as priOrder, IF(`severity` = 0, {$this->config->maxPriValue}, `severity`) as severityOrder")->from(TABLE_BUG)->alias('t1') - ->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id') - ->where('t1.deleted')->eq(0) - ->andWhere('t1.product')->in($productIdList) - ->beginIF($projectID)->andWhere('t1.project')->eq($projectID)->fi() - ->beginIF($this->app->tab !== 'qa')->andWhere('t1.execution')->in($executionIdList)->fi() - ->beginIF($branch !== 'all')->andWhere('t1.branch')->eq($branch)->fi() - ->beginIF($moduleIdList)->andWhere('t1.module')->in($moduleIdList)->fi() - ->andWhere("FIND_IN_SET('{$this->app->user->account}', t1.reviewers)") - ->beginIF(!$this->app->user->admin)->andWhere('t1.project')->in('0,' . $this->app->user->view->projects)->fi() - ->orderBy($orderBy) - ->page($pager) - ->fetchAll('id'); - } - /** * Get cases created by bug. * 获取bug建的用例。 diff --git a/module/bug/test/model/getlist.php b/module/bug/test/model/getlist.php index 738994a714..ece7d465f1 100755 --- a/module/bug/test/model/getlist.php +++ b/module/bug/test/model/getlist.php @@ -64,7 +64,6 @@ r(count($bug->getList($browseType[0], $productIdList[2], $projectID[0], $execut r(count($bug->getList($browseType[0], $productIdList[0], $projectID[2], $executionIdList[0], $branch[0], $moduleID[0]))) && p('') && e('0'); //获取不存在项目ID的bug列表,查看数量是否正确 r(count($bug->getList($browseType[0], $productIdList[0], $projectID[0], $executionIdList[2], $branch[0], $moduleID[0]))) && p('') && e('0'); //获取不存在执行ID的bug列表,查看数量是否正确 -r($bug->getList($browseType[0], $productIdList[0], $projectID[0], $executionIdList[0], $branch[0], $moduleID[0])) && p('1:planTitle') && e('计划1'); //获取全部产品1下的全部bug列表,查看ID为1的bug的计划名称是否正确 r($bug->getList($browseType[0], $productIdList[1], $projectID[1], $executionIdList[1], $branch[1], $moduleID[0])) && p('2:title') && e('BUG2'); //获取全部产品1下的项目相关的全部bug列表,查看ID为2的bug的名称是否正确 r($bug->getList($browseType[1], $productIdList[0], $projectID[0], $executionIdList[0], $branch[0], $moduleID[1])) && p('3:module') && e('1'); //获取产品1模块下的bug列表,查看ID为3的bug的module是否正确 r($bug->getList($browseType[2], $productIdList[0], $projectID[0], $executionIdList[0], $branch[0], $moduleID[0])) && p('1:assignedTo') && e('admin'); //获取产品1下指派给我的bug列表,查看ID为1的bug的指派人是否正确 diff --git a/test/data/bug.yaml b/test/data/bug.yaml index bb6ba8333e..95b1952f9a 100644 --- a/test/data/bug.yaml +++ b/test/data/bug.yaml @@ -1,6 +1,7 @@ title: zt_bug -desc: Bug表 -version: 1.0 +desc: "Bug表" +author: automated export +version: "1.0" fields: - field: id range: 1-10000 @@ -33,29 +34,29 @@ fields: - field: title2 range: 1-10000 - field: keywords - range: [] + range: "[]" - field: severity range: 1-4 - field: pri range: 1-4 - field: type - range: [codeerror,config,install,security,performance,standard,automation,designdefect,others] + range: "[codeerror,config,install,security,performance,standard,automation,designdefect,others]" - field: os - range: []{2},[win10,windows,android,ios] + range: "[]{2},[win10,windows,android,ios]" - field: browser - range: [] + range: "[]" - field: hardware - range: [] + range: "[]" - field: found - range: [] + range: "[]" - field: steps - range: [

【步骤】


【结果】


【期望】


,【步骤】进入成果展示
【结果】乱码
【期望】正常显示
] + range: "[

【步骤】


【结果】


【期望】


,【步骤】进入成果展示
【结果】乱码
【期望】正常显示
]" - field: status range: active{50},resolved{30},closed{20} - field: subStatus - range: [] + range: "[]" - field: color - range: [#3da7f5,#75c941,#2dbdb2,#797ec9,#ffaf38,#ff4e3e] + range: "[#3da7f5,#75c941,#2dbdb2,#797ec9,#ffaf38,#ff4e3e]" - field: confirmed range: 0,1 - field: activatedCount @@ -71,7 +72,7 @@ fields: - field: openedBuild range: 1,0,1,trunk{97} - field: assignedTo - range: [admin,dev1,test1]{30},[]{20},[admin,dev1,test1]{20},[]{10},closed{20} + range: "[admin,dev1,test1]{30},[]{20},[admin,dev1,test1]{20},[]{10},closed{20}" - field: assignedDate range: "(-1M)-(+1w):-1D" type: timestamp @@ -84,11 +85,11 @@ fields: loop: 0 format: "YYYY-MM-DD" - field: resolvedBy - range: []{50},$assignedTo{30},admin{20} + range: "[]{50},$assignedTo{30},admin{20}" - field: resolution - range: []{50},bydesign{5},duplicate{5},external{5},fixed{5},notrepro{2},postponed{3},willnotfix{5},fixed{10},bydesign,external,notrepro,postponed,willnotfix,duplicate{5} + range: "[]{50},bydesign{5},duplicate{5},external{5},fixed{5},notrepro{2},postponed{3},willnotfix{5},fixed{10},bydesign,external,notrepro,postponed,willnotfix,duplicate{5}" - field: resolvedBuild - range: []{55},trunk{15},[]{25},trunk{5} + range: "[]{55},trunk{15},[]{25},trunk{5}" - field: resolvedDate range: "(+1w)-(-2w):-1D" type: timestamp @@ -97,7 +98,7 @@ fields: loop: 0 format: "YYYY-MM-DD" - field: closedBy - range: []{50},admin{30} + range: "[]{50},admin{30}" - field: closedDate range: - field: duplicateBug