* Optimize bug browse query.

This commit is contained in:
wangyuting
2023-08-10 09:31:49 +08:00
parent 6e7910bcc3
commit 5c528dec96
3 changed files with 6 additions and 3 deletions
+3
View File
@@ -36,3 +36,6 @@ MODIFY COLUMN `subject` text NOT NULL AFTER `ccList`,
DROP INDEX `objectType_toList_status`,
ADD INDEX `objectType`(`objectType` ASC),
ADD INDEX `status`(`status` ASC);
CREATE INDEX deleted ON zt_bug (deleted);
CREATE INDEX product_status_deleted ON zt_bug (product,status,deleted);
+1 -2
View File
@@ -172,7 +172,7 @@ class bug extends control
}
else
{
$executions = $this->loadModel('execution')->getPairs($this->projectID, 'all', 'empty|withdelete|hideMultiple');
$executions = $this->loadModel('execution')->fetchPairs($this->projectID, 'all', 'empty|withdelete|hideMultiple');
if($this->config->cache->enable) $this->cache->set($cacheKey, $executions);
}
@@ -234,7 +234,6 @@ class bug extends control
$this->view->position[] = $this->lang->bug->common;
$this->view->productID = $productID;
$this->view->product = $product;
$this->view->projectProducts = $this->product->getProducts($this->projectID);
$this->view->productName = $productName;
$this->view->builds = $this->loadModel('build')->getBuildPairs($productID, $branch);
$this->view->releasedBuilds = $this->loadModel('release')->getReleasedBuilds($productID, $branch);
+2 -1
View File
@@ -2861,7 +2861,8 @@ class bugModel extends model
->beginIF($projectID)->andWhere('project')->eq($projectID)->fi()
->andWhere('deleted')->eq(0)
->beginIF(!$this->app->user->admin)->andWhere('project')->in('0,' . $this->app->user->view->projects)->fi()
->orderBy($orderBy)->page($pager)
->orderBy($orderBy)
->page($pager)
->fetchAll();
}