* Finish task #7527.

This commit is contained in:
holan20180123
2020-07-26 14:44:40 +08:00
parent 97bfc8fd50
commit 69ffb2d3c4
5 changed files with 83 additions and 30 deletions
+21 -13
View File
@@ -117,10 +117,12 @@ class testreport extends control
* @param int $objectID
* @param string $objectType
* @param string $extra
* @param string $begin
* @param string $end
* @access public
* @return void
*/
public function create($objectID = 0, $objectType = 'testtask', $extra = '')
public function create($objectID = 0, $objectType = 'testtask', $extra = '', $begin = '', $end = '')
{
if($_POST)
{
@@ -165,8 +167,8 @@ class testreport extends control
if($productID != $task->product) die(js::error($this->lang->error->accessDenied) . js::locate('back'));
$productIdList[$productID] = $productID;
$begin = $task->begin;
$end = $task->end;
$begin = !empty($begin) ? date("Y-m-d", strtotime($begin)) : $task->begin;
$end = !empty($end) ? date("Y-m-d", strtotime($end)) : $task->end;
$project = $this->project->getById($task->project);
$builds = array();
if($task->build == 'trunk')
@@ -225,8 +227,8 @@ class testreport extends control
$builds = $this->build->getByList($buildIdList);
$stories = !empty($builds) ? $this->testreport->getStories4Test($builds) : $this->story->getProjectStories($project->id);;
$begin = $project->begin;
$end = $project->end;
$begin = !empty($begin) ? date("Y-m-d", strtotime($begin)) : $project->begin;
$end = !empty($end) ? date("Y-m-d", strtotime($end)) : $project->end;
$owner = current($owners);
$bugs = $this->testreport->getBugs4Test($builds, $productIdList, $begin, $end, 'project');
@@ -267,6 +269,7 @@ class testreport extends control
$this->view->objectID = $objectID;
$this->view->objectType = $objectType;
$this->view->extra = $extra;
$this->display();
}
@@ -278,7 +281,7 @@ class testreport extends control
* @access public
* @return void
*/
public function edit($reportID, $from = 'product')
public function edit($reportID, $from = 'product', $begin = '', $end ='')
{
if($_POST)
{
@@ -295,6 +298,8 @@ class testreport extends control
$report = $this->testreport->getById($reportID);
$project = $this->project->getById($report->project);
$begin = !empty($begin) ? date("Y-m-d", strtotime($begin)) : $report->begin;
$end = !empty($end) ? date("Y-m-d", strtotime($end)) : $report->end;
if($from == 'product' and is_numeric($report->product))
{
$product = $this->product->getById($report->product);
@@ -333,7 +338,7 @@ class testreport extends control
$stories = empty($build->stories) ? array() : $this->story->getByList($build->stories);
if(!empty($build->id)) $builds[$build->id] = $build;
$bugs = $this->testreport->getBugs4Test($builds, $report->product, $report->begin, $report->end);
$bugs = $this->testreport->getBugs4Test($builds, $report->product, $begin, $end);
}
$tasks = array($task->id => $task);
@@ -346,15 +351,18 @@ class testreport extends control
$builds = $this->build->getByList($report->builds);
$stories = !empty($builds) ? $this->testreport->getStories4Test($builds) : $this->story->getProjectStories($project->id);;
$bugs = $this->testreport->getBugs4Test($builds, $productIdList, $report->begin, $report->end, 'project');
$bugs = $this->testreport->getBugs4Test($builds, $productIdList, $begin, $end, 'project');
}
$cases = $this->testreport->getTaskCases($tasks, $report->begin, $report->end);
$bugInfo = $this->testreport->getBugInfo($tasks, $productIdList, $report->begin, $report->end, $builds);
$cases = $this->testreport->getTaskCases($tasks, $begin, $end);
$bugInfo = $this->testreport->getBugInfo($tasks, $productIdList, $begin, $end, $builds);
$this->view->title = $report->title . $this->lang->testreport->edit;
$this->view->report = $report;
$this->view->from = $from;
$this->view->begin = $begin;
$this->view->end = $end;
$this->view->stories = $stories;
$this->view->bugs = $bugs;
$this->view->project = $project;
@@ -366,10 +374,10 @@ class testreport extends control
$this->view->users = $this->user->getPairs('noletter|noclosed|nodeleted');
$this->view->cases = $cases;
$this->view->caseSummary = $this->testreport->getResultSummary($tasks, $cases, $report->begin, $report->end);
$this->view->caseSummary = $this->testreport->getResultSummary($tasks, $cases, $begin, $end);
$perCaseResult = $this->testreport->getPerCaseResult4Report($tasks, $cases, $report->begin, $report->end);
$perCaseRunner = $this->testreport->getPerCaseRunner4Report($tasks, $cases, $report->begin, $report->end);
$perCaseResult = $this->testreport->getPerCaseResult4Report($tasks, $cases, $begin, $end);
$perCaseRunner = $this->testreport->getPerCaseRunner4Report($tasks, $cases, $begin, $end);
$this->view->datas['testTaskPerRunResult'] = $this->loadModel('report')->computePercent($perCaseResult);
$this->view->datas['testTaskPerRunner'] = $this->report->computePercent($perCaseRunner);
+5
View File
@@ -10,3 +10,8 @@ $(function()
};
resizeChartTable();
});
function changeDate()
{
$("#refresh").removeAttr("style");
}
+2 -12
View File
@@ -95,18 +95,13 @@ class testreportModel extends model
->add('createdDate', helper::now())
->join('stories', ',')
->join('builds', ',')
->join('bugs', ',')
->join('cases', ',')
->join('members', ',')
->remove('files,labels,uid')
->get();
$data->members = trim($data->members, ',');
$builds = array();
$build = $this->loadModel('build')->getById($data->builds);
if(!empty($build->id)) $builds[$build->id] = $build;
$bugs = $this->getBugs4Test($builds, $data->product, $data->begin, $data->end);
if(!empty($bugs)) $data->bugs = implode(",", array_keys($bugs));
$data = $this->loadModel('file')->processImgURL($data, $this->config->testreport->editor->create['id'], $this->post->uid);
$this->dao->insert(TABLE_TESTREPORT)->data($data)->autocheck()
->batchCheck($this->config->testreport->create->requiredFields, 'notempty')
@@ -134,18 +129,13 @@ class testreportModel extends model
->stripTags($this->config->testreport->editor->edit['id'], $this->config->allowedTags)
->join('stories', ',')
->join('builds', ',')
->join('bugs', ',')
->join('cases', ',')
->join('members', ',')
->remove('files,labels,uid')
->get();
$data->members = trim($data->members, ',');
$builds = array();
$build = $this->loadModel('build')->getById($data->builds);
if(!empty($build->id)) $builds[$build->id] = $build;
$bugs = $this->getBugs4Test($builds, $data->product, $data->begin, $data->end);
$data->bugs = !empty($bugs) ? implode(",", array_keys($bugs)) : '';
$data = $this->loadModel('file')->processImgURL($data, $this->config->testreport->editor->edit['id'], $this->post->uid);
$this->dao->update(TABLE_TESTREPORT)->data($data)->autocheck()
->batchCheck($this->config->testreport->edit->requiredFields, 'notempty')
+28 -3
View File
@@ -37,10 +37,12 @@
<th class='w-100px'><?php echo $lang->testreport->startEnd?></th>
<td class='w-p50'>
<div class='input-group'>
<?php echo html::input('begin', $begin, "class='form-control form-date'")?>
<?php echo html::input('begin', $begin, "class='form-control form-date' onchange=changeDate()")?>
<span class='input-group-addon'> ~ </span>
<?php echo html::input('end', $end, "class='form-control form-date'")?>
<?php
<?php echo html::input('end', $end, "class='form-control form-date' onchange=changeDate()")?>
<?php echo "<div class='input-group-btn' id='refresh' style='display: none'>"?>
<a onclick=refreshPage() class='btn btn-icon' data-toggle='modal' data-type='iframe'><?php echo $lang->refresh?></a>
<?php echo "</div>";
echo html::hidden('product', $productIdList) . ($config->global->flow != 'onlyTest' ? html::hidden('project', isset($project->id) ? $project->id : 0) : '') . html::hidden('tasks', $tasks);
echo html::hidden('objectID', $objectID) . html::hidden('objectType', $objectType);
?>
@@ -136,4 +138,27 @@
</form>
</div>
</div>
<script>
function refreshPage()
{
var begin = $("#begin").val();
var end = $("#end").val();
var objectID = $("#objectID").val();
var objectType = $("#objectType").val();
var extra = <?php echo $extra;?>;
if(begin.indexOf('-') != -1)
{
var beginarray = begin.split("-");
var begin = '';
for(i = 0; i < beginarray.length; i++) begin = begin + beginarray[i];
}
if(end.indexOf('-') != -1)
{
var endarray = end.split("-");
var end = '';
for(i = 0 ; i < endarray.length ; i++) end = end + endarray[i];
}
location.href = createLink('testreport', 'create', "project=" + objectID + "&objectType=" + objectType + "&extra=" + extra + "&begin=" + begin + "&end=" + end);
}
</script>
<?php include '../../common/view/footer.html.php';?>
+27 -2
View File
@@ -28,9 +28,12 @@
<th class='w-100px'><?php echo $lang->testreport->startEnd?></th>
<td class='w-p50'>
<div class='input-group'>
<?php echo html::input('begin', $report->begin, "class='form-control form-date'")?>
<?php echo html::input('begin', $begin, "class='form-control form-date' onchange=changeDate()")?>
<span class='input-group-addon'> ~ </span>
<?php echo html::input('end', $report->end, "class='form-control form-date'")?>
<?php echo html::input('end', $end, "class='form-control form-date' onchange=changeDate()")?>
<?php echo "<div class='input-group-btn' id='refresh' style='display: none'>"?>
<a onclick=refreshPage() class='btn btn-icon' data-toggle='modal' data-type='iframe'><?php echo $lang->refresh?></a>
<?php echo "</div>"?>
<?php echo html::hidden('product', $productIdList) . ($config->global->flow != 'onlyTest' ? html::hidden('project', $project->id) : '') . html::hidden('tasks', $tasks);?>
</div>
</td>
@@ -113,4 +116,26 @@
</form>
</div>
</div>
<script>
function refreshPage()
{
var begin = $("#begin").val();
var end = $("#end").val();
var reportID = <?php echo $report->id;?>;
var from = <?php echo "'" . $from . "'";?>;
if(begin.indexOf('-') != -1)
{
var beginarray = begin.split("-");
var begin = '';
for(i = 0; i < beginarray.length; i++) begin = begin + beginarray[i];
}
if(end.indexOf('-') != -1)
{
var endarray = end.split("-");
var end = '';
for(i = 0 ; i < endarray.length ; i++) end = end + endarray[i];
}
location.href = createLink('testreport', 'edit', "reportID=" + reportID + "&from=" + from + "&begin=" + begin + "&end=" + end);
}
</script>
<?php include '../../common/view/footer.html.php';?>