diff --git a/module/testreport/control.php b/module/testreport/control.php index 921202ba7c..5ff4d006cd 100644 --- a/module/testreport/control.php +++ b/module/testreport/control.php @@ -445,7 +445,7 @@ 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->begin, $report->end, $report->cases, $pager); - $totalCases = $this->testreport->getTaskCases($tasks, $report->begin, $report->end, $report->cases); + $caseIdList = $this->testreport->getCaseIdList($reportID); $bugInfo = $this->testreport->getBugInfo($tasks, $report->product, $report->begin, $report->end, $builds); if($report->objectType == 'testtask') @@ -473,10 +473,10 @@ 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, $totalCases, $report->begin, $report->end); + $this->view->caseSummary = $this->testreport->getResultSummary($tasks, $caseIdList, $report->begin, $report->end); - $perCaseResult = $this->testreport->getPerCaseResult4Report($tasks, $totalCases, $report->begin, $report->end); - $perCaseRunner = $this->testreport->getPerCaseRunner4Report($tasks, $totalCases, $report->begin, $report->end); + $perCaseResult = $this->testreport->getPerCaseResult4Report($tasks, $caseIdList, $report->begin, $report->end); + $perCaseRunner = $this->testreport->getPerCaseRunner4Report($tasks, $caseIdList, $report->begin, $report->end); $this->view->datas['testTaskPerRunResult'] = $this->loadModel('report')->computePercent($perCaseResult); $this->view->datas['testTaskPerRunner'] = $this->report->computePercent($perCaseRunner); diff --git a/module/testreport/model.php b/module/testreport/model.php index ea247232d0..5e9f74a0b1 100644 --- a/module/testreport/model.php +++ b/module/testreport/model.php @@ -362,6 +362,24 @@ class testreportModel extends model return $cases; } + /** + * Get caseID list. + * + * @param int $reportID + * @access public + * @return void + */ + public function getCaseIdList($reportID) + { + $caseIdList = $this->dao->select('`case`')->from(TABLE_TESTREPORT)->alias('t1') + ->leftJoin(TABLE_TESTRUN)->alias('t2')->on('t1.tasks=t2.task') + ->where('t1.id')->eq($reportID) + ->andWhere('t1.deleted')->eq(0) + ->fetchPairs('case'); + + return $caseIdList; + } + /** * Get result summary. * @@ -409,6 +427,7 @@ class testreportModel extends model ->leftJoin(TABLE_TESTRUN)->alias('t2') ->on('t1.run= t2.id') ->where('t2.task')->in(array_keys($tasks)) + ->andwhere('t1.date = t2.lastRunDate') ->andWhere('t1.`case`')->in(array_keys($cases)) ->andWhere('t1.date')->ge($begin) ->andWhere('t1.date')->le($end . " 23:59:59") @@ -440,6 +459,7 @@ class testreportModel extends model ->leftJoin(TABLE_TESTRUN)->alias('t2') ->on('t1.run= t2.id') ->where('t2.task')->in(array_keys($tasks)) + ->andwhere('t1.date = t2.lastRunDate') ->andWhere('t1.`case`')->in(array_keys($cases)) ->andWhere('t1.date')->ge($begin) ->andWhere('t1.date')->le($end . " 23:59:59")