* Modify the code.

This commit is contained in:
mayue
2021-12-23 14:34:44 +08:00
parent f8f763f9dd
commit be1671c243
2 changed files with 32 additions and 0 deletions
+3
View File
@@ -181,6 +181,9 @@ class bug extends control
/* Process bug for check story changed. */
$bugs = $this->loadModel('story')->checkNeedConfirm($bugs);
/* Process the openedBuild and resolvedBuild fields. */
$bugs = $this->bug->processBuildForBugs($bugs);
/* Get story and task id list. */
$storyIdList = $taskIdList = array();
foreach($bugs as $bug)
+29
View File
@@ -1375,6 +1375,35 @@ class bugModel extends model
$this->loadModel('search')->setSearchParams($this->config->bug->search);
}
/**
* Process the openedBuild and resolvedBuild fields for bugs.
*
* @param array $bugs
* @access public
* @return array
*/
public function processBuildForBugs($bugs)
{
$productIdList = array();
foreach($bugs as $bug) $productIdList[$bug->id] = $bug->product;
$builds = $this->loadModel('build')->getBuildPairs(array_unique($productIdList), 'all', $params = '');
/* Process the openedBuild and resolvedBuild fields. */
foreach($bugs as $key => $bug)
{
$openBuildIdList = explode(',', $bug->openedBuild);
$openedBuild = '';
foreach($openBuildIdList as $buildID)
{
$openedBuild .= isset($builds[$buildID]) ? $builds[$buildID] : $buildID;
$openedBuild .= ',';
}
$bug->openedBuild = rtrim($openedBuild, ',');
$bug->resolvedBuild = isset($builds[$bug->resolvedBuild]) ? $builds[$bug->resolvedBuild] : $bug->resolvedBuild;
}
return $bugs;
}
/**
* Extract accounts from some bugs.
*