* fix a bug #598.

This commit is contained in:
wangyidong
2014-08-26 09:21:33 +00:00
parent 2088a01aee
commit 79abe30e72
3 changed files with 20 additions and 16 deletions
+2 -2
View File
@@ -723,7 +723,7 @@ class testtask extends control
$this->view->run = $run;
$this->view->preCase = $preCase;
$this->view->nextCase = $nextCase;
$this->view->results = $this->testtask->getResults(0, $caseID);
$this->view->results = $this->testtask->getResults($runID, $caseID);
$this->view->users = $this->loadModel('user')->getPairs('noclosed, noletter');
$this->view->caseID = $caseID;
$this->view->version = $version;
@@ -804,12 +804,12 @@ class testtask extends control
$testtaskID = $this->dao->select('task')->from(TABLE_TESTRUN)->where('id')->eq($runID)->fetch('task');
$testtask = $this->dao->select('build, product')->from(TABLE_TESTTASK)->where('id')->eq($testtaskID)->fetch();
$builds = $this->loadModel('build')->getProductBuildPairs($testtask->product);
$this->view->build = isset($builds[$testtask->build]) ? $builds[$testtask->build] : '';
}
$this->view->case = $case;
$this->view->results = $results;
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($case->product);
$this->view->users = $this->loadModel('user')->getPairs('noclosed, noletter');
die($this->display());
+12 -6
View File
@@ -448,23 +448,29 @@ class testtaskModel extends model
if(!$results) return array();
$relatedVersions = array();
$runIdList = array();
foreach($results as $result)
{
$relatedVersions[] = $result->version;
$runCaseID = $result->case;
$runIdList[$result->run] = $result->run;
$relatedVersions[] = $result->version;
$runCaseID = $result->case;
}
$relatedVersions = array_unique($relatedVersions);
$relatedSteps = $this->dao->select('*')->from(TABLE_CASESTEP)
->beginIF($caseID)->where('`case`')->eq($caseID)->fi()
->beginIF($runID)->where('`case`')->eq($runCaseID)->fi()
$relatedSteps = $this->dao->select('*')->from(TABLE_CASESTEP)
->where('`case`')->eq($runCaseID)
->andWhere('version')->in($relatedVersions)
->fetchAll();
$runs = $this->dao->select('t1.id,t2.build')->from(TABLE_TESTRUN)->alias('t1')
->leftJoin(TABLE_TESTTASK)->alias('t2')->on('t1.task=t2.id')
->where('t1.id')->in($runIdList)
->fetchPairs();
foreach($results as $resultID => $result)
{
$result->stepResults = unserialize($result->stepResults);
$results[$resultID] = $result;
$result->build = $result->run ? zget($runs, $result->run, 0) : 0;
$results[$resultID] = $result;
foreach($relatedSteps as $key => $step)
{
+6 -8
View File
@@ -29,26 +29,24 @@
<table class='table table-condensed table-hover' style='border: 1px solid #ddd'>
<?php $count = count($results);?>
<caption class='text-left' style='border: 1px solid #ddd; border-bottom: none;'>
<?php if(isset($build)):?>
<div class='pull-right'><strong class='text-important'><?php echo $lang->testtask->build . $lang->colon . $build;?></strong></div>
<?php endif; ?>
<strong><?php echo $lang->testcase->result?> &nbsp;<span> <?php printf($lang->testtask->showResult, $count)?></span> <span class='result-tip'></span></strong>
<strong><?php echo $lang->testcase->result?> &nbsp;<span> <?php printf($lang->testtask->showResult, $count)?></span> <span class='result-tip'></span></strong>
</caption>
<?php $failCount = 0; ?>
<?php foreach($results as $result):?>
<?php
$class = ($result->caseResult == 'pass' ? 'success' : ($result->caseResult == 'fail' ? 'danger' : ($result->caseResult == 'blocked' ? 'warning' : '')));
if($class != 'success') $failCount++;
$class = ($result->caseResult == 'pass' ? 'success' : ($result->caseResult == 'fail' ? 'danger' : ($result->caseResult == 'blocked' ? 'warning' : '')));
if($class != 'success') $failCount++;
?>
<tr class='result-item' style='cursor: pointer'>
<td class='w-120px'> &nbsp; #<?php echo $result->id?></td>
<td class='w-180px'><?php echo $result->date;?></td>
<td><?php echo $users[$result->lastRunner] . ' ' . $lang->testtask->runCase;?></td>
<td class='text-right'><strong class='text-<?php echo $class;?>'><?php echo $lang->testcase->resultList[$result->caseResult]?></strong></td>
<td class='w-150px'><?php echo zget($builds, $result->build);?></td>
<td class='w-50px text-right'><strong class='text-<?php echo $class;?>'><?php echo $lang->testcase->resultList[$result->caseResult]?></strong></td>
<td class='w-50px text-center'><i class='collapse-handle icon-chevron-down text-muted'></i></td>
</tr>
<tr class='result-detail hide'>
<td colspan='5' class='pd-0'>
<td colspan='6' class='pd-0'>
<table class='table table-condensed borderless mg-0'>
<thead>
<tr>