Merge branch 'sprint/scx_apibug' into 'master'

* Fix testcase api bug and modify bug api data consistent.

See merge request easycorp/zentaopms!7383
This commit is contained in:
刘刚
2023-04-12 06:32:55 +00:00
2 changed files with 7 additions and 24 deletions
+1 -20
View File
@@ -36,32 +36,13 @@ class bugsEntry extends entry
$this->loadModel('product');
foreach($bugs as $bug)
{
$status = array('code' => $bug->status, 'name' => $this->lang->bug->statusList[$bug->status]);
if($bug->status == 'active' and $bug->confirmed) $status = array('code' => 'confirmed', 'name' => $this->lang->bug->labelConfirmed);
if($bug->resolution == 'postponed') $status = array('code' => 'postponed', 'name' => $this->lang->bug->labelPostponed);
if(!empty($bug->delay)) $status = array('code' => 'delay', 'name' => $this->lang->bug->overdueBugs);
$bug->status = $status['code'];
$bug->statusName = $status['name'];
$product = $this->product->getById($bug->product);
$bug->statusName = $this->lang->bug->statusList[$bug->status];
$bug->productStatus = $product->status;
$result[$bug->id] = $this->format($bug, 'activatedDate:time,openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,mailto:userList,resolvedBy:user,resolvedDate:time,closedBy:user,closedDate:time,lastEditedBy:user,lastEditedDate:time,deadline:date,deleted:bool');
}
$storyChangeds = $this->dao->select('t1.id')->from(TABLE_BUG)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id')
->where('t1.id')->in(array_keys($result))
->andWhere('t1.story')->ne('0')
->andWhere('t1.storyVersion != t2.version')
->fetchPairs('id', 'id');
foreach($storyChangeds as $bugID)
{
$status = array('code' => 'storyChanged', 'name' => $this->lang->bug->changed);
$result[$bugID]->status = $status['code'];
$result[$bugID]->statusName = $status['name'];
}
return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'bugs' => array_values($result)));
}
+6 -4
View File
@@ -23,10 +23,8 @@ class testcasesEntry extends entry
if(empty($productID)) $productID = $this->param('product', 0);
if(empty($productID)) return $this->sendError(400, 'Need product id.');
$this->app->cookie->caseModule = 0;
$this->app->cookie->caseSuite = 0;
$type = $this->param('status', 'all');
$branch = $this->param('branch', '');
$param = 0;
$moduleID = $this->param('module', 0);
if($moduleID)
@@ -35,8 +33,12 @@ class testcasesEntry extends entry
$param = $moduleID;
}
$this->app->cookie->caseModule = 0;
$this->app->cookie->caseSuite = 0;
$this->app->cookie->preBranch = $branch;
$control = $this->loadController('testcase', 'browse');
$control->browse($productID, $this->param('branch', ''), $type, $param, $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
$control->browse($productID, $this->param('branch', ''), $type, $param, $this->param('caseType', ''), $this->param('order', 'id_desc'), 0, $this->param('limit', 20), $this->param('page', 1));
$data = $this->getData();