Merge branch 'master' of https://github.com/easysoft/zentaopms
This commit is contained in:
@@ -184,6 +184,7 @@ class testreport extends control
|
||||
|
||||
$owners[$task->owner] = $task->owner;
|
||||
$productIdList[$task->product] = $task->product;
|
||||
$this->setChartDatas($task->id);
|
||||
}
|
||||
if(count($productIdList) > 1)
|
||||
{
|
||||
@@ -212,7 +213,7 @@ class testreport extends control
|
||||
$this->view->reportTitle = date('Y-m-d') . " PROJECT#{$project->id} {$project->name} {$this->lang->testreport->common}";
|
||||
|
||||
}
|
||||
$cases = $this->testreport->getTaskCases($tasks);
|
||||
$cases = $this->testreport->getTaskCases($tasks, $begin, $end);
|
||||
$bugInfo = $this->testreport->getBugInfo($tasks, $productIdList, $begin, $end, $builds);
|
||||
|
||||
$this->view->begin = $begin;
|
||||
@@ -231,7 +232,7 @@ 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);
|
||||
$this->view->caseSummary = $this->testreport->getResultSummary($tasks, $cases, $begin, $end);
|
||||
|
||||
$this->view->legacyBugs = $bugInfo['legacyBugs'];
|
||||
unset($bugInfo['legacyBugs']);
|
||||
@@ -315,14 +316,18 @@ class testreport extends control
|
||||
{
|
||||
$tasks = $this->testtask->getProjectTasks($report->project);
|
||||
$productIdList = array();
|
||||
foreach($tasks as $task) $productIdList[$task->product] = $task->product;
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
$productIdList[$task->product] = $task->product;
|
||||
$this->setChartDatas($task->id);
|
||||
}
|
||||
|
||||
$stories = $this->story->getProjectStories($project->id);
|
||||
$builds = $this->build->getProjectBuilds($project->id);
|
||||
$bugs = $this->testreport->getBugs4Test($builds, $productIdList, $report->begin, $report->end, 'project');
|
||||
}
|
||||
|
||||
$cases = $this->testreport->getTaskCases($tasks);
|
||||
$cases = $this->testreport->getTaskCases($tasks, $report->begin, $report->end);
|
||||
$bugInfo = $this->testreport->getBugInfo($tasks, $productIdList, $report->begin, $report->end, $builds);
|
||||
|
||||
$this->view->title = $report->title . $this->lang->testreport->edit;
|
||||
@@ -339,7 +344,7 @@ 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);
|
||||
$this->view->caseSummary = $this->testreport->getResultSummary($tasks, $cases, $report->begin, $report->end);
|
||||
|
||||
$this->view->legacyBugs = $bugInfo['legacyBugs'];
|
||||
unset($bugInfo['legacyBugs']);
|
||||
@@ -391,10 +396,17 @@ class testreport extends control
|
||||
|
||||
$tasks = $report->tasks ? $this->testtask->getByList($report->tasks) : array();;
|
||||
$builds = $report->builds ? $this->build->getByList($report->builds) : array();
|
||||
$cases = $this->testreport->getTaskCases($tasks, $report->cases);
|
||||
$cases = $this->testreport->getTaskCases($tasks, $report->begin, $report->end, $report->cases);
|
||||
$bugInfo = $this->testreport->getBugInfo($tasks, $report->product, $report->begin, $report->end, $builds);
|
||||
|
||||
if($report->objectType == 'testtask') $this->setChartDatas($report->objectID);
|
||||
if($report->objectType == 'testtask')
|
||||
{
|
||||
$this->setChartDatas($report->objectID);
|
||||
}
|
||||
elseif($tasks)
|
||||
{
|
||||
foreach($tasks as $task) $this->setChartDatas($task->id);
|
||||
}
|
||||
|
||||
$this->view->title = $report->title;
|
||||
$this->view->browseLink = $browseLink;
|
||||
@@ -410,7 +422,7 @@ class testreport extends control
|
||||
$this->view->actions = $this->loadModel('action')->getList('testreport', $reportID);
|
||||
|
||||
$this->view->storySummary = $this->product->summary($stories);
|
||||
$this->view->caseSummary = $this->testreport->getResultSummary($tasks, $cases);
|
||||
$this->view->caseSummary = $this->testreport->getResultSummary($tasks, $cases, $report->begin, $report->end);
|
||||
|
||||
$this->view->legacyBugs = $bugInfo['legacyBugs'];
|
||||
unset($bugInfo['legacyBugs']);
|
||||
@@ -489,7 +501,36 @@ class testreport extends control
|
||||
if(!empty($chartType)) $chartOption->type = $chartType;
|
||||
|
||||
$this->view->charts[$chart] = $chartOption;
|
||||
$this->view->datas[$chart] = $this->report->computePercent($chartData);
|
||||
if(isset($this->view->datas[$chart]))
|
||||
{
|
||||
$existDatas = $this->view->datas[$chart];
|
||||
$sum = 0;
|
||||
foreach($chartData as $key => $data)
|
||||
{
|
||||
if(isset($existDatas[$key]))
|
||||
{
|
||||
$data->value += $existDatas[$key]->value;
|
||||
$sum += $data->value;
|
||||
unset($existDatas[$chart][$key]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach($existDatas as $key => $data)
|
||||
{
|
||||
$sum += $data->value;
|
||||
$chartData[$key] = $data;
|
||||
}
|
||||
if($sum)
|
||||
{
|
||||
foreach($chartData as $data) $data->percent = round($data->value / $sum, 2);
|
||||
}
|
||||
ksort($chartData);
|
||||
$this->view->datas[$chart] = $chartData;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->view->datas[$chart] = $this->report->computePercent($chartData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ $lang->testreport->deleted = 'Deleted';
|
||||
$lang->testreport->legendBasic = 'Basic Info';
|
||||
$lang->testreport->legendStoryAndBug = 'Stories and Bugs of Test';
|
||||
$lang->testreport->legendBuild = 'Build Info';
|
||||
$lang->testreport->legendCase = 'Case executed';
|
||||
$lang->testreport->legendCase = 'Linked Case';
|
||||
$lang->testreport->legendLegacyBugs = 'Legacy Bugs';
|
||||
$lang->testreport->legendReport = 'Report';
|
||||
$lang->testreport->legendComment = 'Sum up';
|
||||
|
||||
@@ -38,7 +38,7 @@ $lang->testreport->deleted = '已删除';
|
||||
$lang->testreport->legendBasic = '基本信息';
|
||||
$lang->testreport->legendStoryAndBug = '测试范围';
|
||||
$lang->testreport->legendBuild = '测试轮次';
|
||||
$lang->testreport->legendCase = '执行的用例';
|
||||
$lang->testreport->legendCase = '关联的用例';
|
||||
$lang->testreport->legendLegacyBugs = '遗留的Bug';
|
||||
$lang->testreport->legendReport = '报表';
|
||||
$lang->testreport->legendComment = '总结';
|
||||
|
||||
@@ -319,14 +319,41 @@ class testreportModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTaskCases($tasks, $idList = '')
|
||||
public function getTaskCases($tasks, $begin, $end, $idList = '')
|
||||
{
|
||||
return $this->dao->select('t2.*,t1.task,t1.assignedTo,t1.lastRunner,t1.lastRunDate,t1.lastRunResult,t1.status')->from(TABLE_TESTRUN)->alias('t1')
|
||||
$cases = $this->dao->select('t2.*,t1.task,t1.assignedTo,t1.status')->from(TABLE_TESTRUN)->alias('t1')
|
||||
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case=t2.id')
|
||||
->where('t1.task')->in(array_keys($tasks))
|
||||
->beginIF($idList)->andWhere('t2.id')->in($idList)->fi()
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->fetchAll('id');
|
||||
|
||||
$results = $this->dao->select('t1.*')->from(TABLE_TESTRESULT)->alias('t1')
|
||||
->leftJoin(TABLE_TESTRUN)->alias('t2')->on('t1.run=t2.id')
|
||||
->where('t2.task')->in(array_keys($tasks))
|
||||
->andWhere('t1.`case`')->in(array_keys($cases))
|
||||
->andWhere('t1.date')->ge($begin)
|
||||
->andWhere('t1.date')->le($end . " 23:59:59")
|
||||
->orderBy('date')
|
||||
->fetchAll('case');
|
||||
|
||||
foreach($cases as $caseID => $case)
|
||||
{
|
||||
$case->lastRunner = '';
|
||||
$case->lastRunDate = '';
|
||||
$case->lastRunResult = '';
|
||||
$case->status = 'wait';
|
||||
if(isset($results[$caseID]))
|
||||
{
|
||||
$result = $results[$caseID];
|
||||
$case->lastRunner = $result->lastRunner;
|
||||
$case->lastRunDate = $result->date;
|
||||
$case->lastRunResult = $result->caseResult;
|
||||
$case->status = $result->caseResult == 'blocked' ? 'blocked' : 'done';
|
||||
}
|
||||
}
|
||||
|
||||
return $cases;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -337,13 +364,16 @@ class testreportModel extends model
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getResultSummary($tasks, $cases)
|
||||
public function getResultSummary($tasks, $cases, $begin, $end)
|
||||
{
|
||||
$results = $this->dao->select('t1.*')->from(TABLE_TESTRESULT)->alias('t1')
|
||||
->leftJoin(TABLE_TESTRUN)->alias('t2')->on('t1.run=t2.id')
|
||||
->where('t2.task')->in(array_keys($tasks))
|
||||
->andWhere('t1.`case`')->in(array_keys($cases))
|
||||
->fetchAll();
|
||||
->andWhere('t1.date')->ge($begin)
|
||||
->andWhere('t1.date')->le($end . " 23:59:59")
|
||||
->orderBy('date')
|
||||
->fetchAll('case');
|
||||
$failResults = array();
|
||||
$runCasesNum = array();
|
||||
foreach($results as $result)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<div class='chart-canvas'><canvas id='chart-<?php echo $chartType ?>' width='<?php echo $chartOption->width;?>' height='<?php echo $chartOption->height;?>' data-responsive='true'></canvas></div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<td class='text-top'>
|
||||
<div class='table-wrapper' style='overflow:auto'>
|
||||
<table class='table table-condensed table-hover table-striped table-bordered table-chart' data-chart='<?php echo $chartOption->type; ?>' data-target='#chart-<?php echo $chartType ?>' data-animation='false'>
|
||||
<thead>
|
||||
@@ -71,7 +71,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<td class='text-top'>
|
||||
<div class='table-wrapper' style='overflow:auto'>
|
||||
<table class='table table-condensed table-hover table-striped table-bordered table-chart' data-chart='pie' data-target='#chart-<?php echo $infoKey?>' data-animation='false'>
|
||||
<thead>
|
||||
|
||||
Reference in New Issue
Block a user