* Merge 18.9 testtask module.

This commit is contained in:
hufangzhou
2023-11-29 16:22:34 +08:00
parent d5e597a5d4
commit 7ab268bb9c
13 changed files with 104 additions and 6 deletions
+31 -1
View File
@@ -107,10 +107,19 @@ class testtask extends control
/* Query the testtasks from the database. */
$testtasks = $this->testtask->getProductTasks($productID, $branch, $type, $beginTime, $endTime, $sort, $pager);
/* Process testtask members. */
$users = $this->loadModel('user')->getPairs('noclosed|noletter');
foreach($testtasks as $testtask)
{
$members = array();
foreach(explode(',', $testtask->members) as $member) $members[] = zget($users, $member);
$testtask->members = implode(',', array_unique($members));
}
$this->testtaskZen->prepareSummaryForBrowse($testtasks);
$this->view->title = $product->name . $this->lang->colon . $this->lang->testtask->common;
$this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
$this->view->users = $users;
$this->view->tasks = $testtasks;
$this->view->product = $product;
$this->view->branch = $branch;
@@ -199,6 +208,14 @@ class testtask extends control
$formData->project = $execution->project;
}
if($formData->build && empty($formData->execution))
{
$build = $this->loadModel('build')->getById($this->post->build);
$formData->project = $build->project;
}
$formData->members = trim($formData->members, ',');
/* 创建测试单。*/
/* Create a testtask. */
$testtaskID = $this->testtask->create($formData);
@@ -1131,4 +1148,17 @@ class testtask extends control
$result = $this->dao->select('*')->from(TABLE_TESTRESULT)->where('id')->eq($resultID)->fetch();
return $this->send(array('result' => 'success', 'data' => $result));
}
/**
* AJAX: Get executionID by buildID.
*
* @param int $buildID
* @access public
* @return int
*/
public function ajaxGetExecutionByBuild(int $buildID)
{
$execution = $this->loadModel('execution')->getByBuild($buildID);
return print($execution ? $execution->id : 0);
}
}