* code for task #44937.
This commit is contained in:
@@ -33,10 +33,7 @@ class buildsEntry extends entry
|
||||
$result = array();
|
||||
foreach($data->data->projectBuilds as $productID => $builds)
|
||||
{
|
||||
foreach($builds as $build)
|
||||
{
|
||||
$result[] = $this->format($build, 'bugs:idList,stories:idList,deleted:bool');
|
||||
}
|
||||
foreach($builds as $build) $result[] = $this->format($build, 'bugs:idList,stories:idList,deleted:bool');
|
||||
}
|
||||
|
||||
return $this->send(200, array('total' => count($result), 'builds' => $result));
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* The execution builds entry point of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
|
||||
* @package entries
|
||||
* @version 1
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
class executionBuildsEntry extends entry
|
||||
{
|
||||
/**
|
||||
* GET method.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function get($executionID = 0)
|
||||
{
|
||||
if(empty($executionID)) $executionID = $this->param('execution', 0);
|
||||
if(empty($executionID)) return $this->sendError(400, "Need execution id.");
|
||||
|
||||
$control = $this->loadController('execution', 'build');
|
||||
$control->build($executionID, $this->param('status', 'all'), $this->param('param', 0), $this->param('order', 't1.date_desc,t1.id_desc'));
|
||||
$data = $this->getData();
|
||||
|
||||
if(!isset($data->status)) return $this->sendError(400, 'error');
|
||||
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
|
||||
|
||||
$result = array();
|
||||
foreach($data->data->executionBuilds as $builds)
|
||||
{
|
||||
foreach($builds as $build) $result[] = $this->format($build, 'bugs:idList,stories:idList,deleted:bool');
|
||||
}
|
||||
|
||||
return $this->send(200, array('total' => count($result), 'builds' => $result));
|
||||
}
|
||||
}
|
||||
+4
-3
@@ -80,9 +80,10 @@ $routes['/todos/:id'] = 'todo';
|
||||
$routes['/todos/:id/finish'] = 'todoFinish';
|
||||
$routes['/todos/:id/activate'] = 'todoActivate';
|
||||
|
||||
$routes['/projects/:projectID/builds'] = 'builds';
|
||||
$routes['/builds'] = 'builds';
|
||||
$routes['/builds/:id'] = 'build';
|
||||
$routes['/projects/:id/builds'] = 'builds';
|
||||
$routes['/executions/:id/builds'] = 'executionBuilds';
|
||||
$routes['/builds'] = 'builds';
|
||||
$routes['/builds/:id'] = 'build';
|
||||
|
||||
$routes['/products/:id/testcases'] = 'testcases';
|
||||
$routes['/projects/:id/testcases'] = 'projectCases';
|
||||
|
||||
@@ -160,10 +160,11 @@ class buildModel extends model
|
||||
* @param int $executionID
|
||||
* @param string $type all|product|bysearch
|
||||
* @param int|string $param productID|buildQuery
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getExecutionBuilds($executionID, $type = '', $param = '')
|
||||
public function getExecutionBuilds($executionID, $type = '', $param = '', $orderBy = 't1.date_desc,t1.id_desc')
|
||||
{
|
||||
return $this->dao->select('t1.*, t2.name as executionName, t3.name as productName, t4.name as branchName')
|
||||
->from(TABLE_BUILD)->alias('t1')
|
||||
@@ -174,7 +175,7 @@ class buildModel extends model
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->beginIF($type == 'product' and $param)->andWhere('t1.product')->eq($param)->fi()
|
||||
->beginIF($type == 'bysearch')->andWhere($param)->fi()
|
||||
->orderBy('t1.date DESC, t1.id desc')
|
||||
->orderBy($orderBy)
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
|
||||
@@ -986,10 +986,11 @@ class execution extends control
|
||||
* @param int $executionID
|
||||
* @param string $type all|product|bysearch
|
||||
* @param int $param
|
||||
* @param string $orderBy
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function build($executionID = 0, $type = 'all', $param = 0)
|
||||
public function build($executionID = 0, $type = 'all', $param = 0, $orderBy = 't1.date_desc,t1.id_desc')
|
||||
{
|
||||
/* Load module and set session. */
|
||||
$this->loadModel('testtask');
|
||||
@@ -1015,7 +1016,7 @@ class execution extends control
|
||||
}
|
||||
else
|
||||
{
|
||||
$builds = $this->loadModel('build')->getExecutionBuilds((int)$executionID, $type, $param);
|
||||
$builds = $this->loadModel('build')->getExecutionBuilds((int)$executionID, $type, $param, $orderBy);
|
||||
}
|
||||
|
||||
/* Set execution builds. */
|
||||
|
||||
Reference in New Issue
Block a user