From a2baa7ad5ae1b1377f1069e9250cc2c6340bee3f Mon Sep 17 00:00:00 2001 From: liugang Date: Mon, 23 Jul 2018 14:15:04 +0800 Subject: [PATCH] * Display chart datas of testtask. --- module/testreport/control.php | 31 +++++++++++++ .../testreport/view/blockbugreport.html.php | 46 +++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/module/testreport/control.php b/module/testreport/control.php index f42f97fc9a..a374571706 100644 --- a/module/testreport/control.php +++ b/module/testreport/control.php @@ -158,6 +158,8 @@ class testreport extends control $tasks = array($task->id => $task); $owner = $task->owner; + $this->setChartDatas($objectID); + $this->view->title = $task->name . $this->lang->testreport->create; $this->view->position[] = html::a(inlink('browse', "objectID=$productID&objectType=product&extra={$task->id}"), $task->name); $this->view->position[] = $this->lang->testreport->create; @@ -306,6 +308,8 @@ class testreport extends control $bugs = $this->testreport->getBugs4Test($builds, $report->product, $report->begin, $report->end); } $tasks = array($task->id => $task); + + $this->setChartDatas($report->objectID); } else { @@ -390,6 +394,8 @@ class testreport extends control $cases = $this->testreport->getTaskCases($tasks, $report->cases); $bugInfo = $this->testreport->getBugInfo($tasks, $report->product, $report->begin, $report->end, $builds); + if($report->objectType == 'testtask') $this->setChartDatas($report->objectID); + $this->view->title = $report->title; $this->view->browseLink = $browseLink; $this->view->position[] = $report->title; @@ -461,4 +467,29 @@ class testreport extends control return $projectID; } } + + /** + * Set chart datas of cases. + * + * @param int $taskID + * @access public + * @return void + */ + public function setChartDatas($taskID) + { + $this->loadModel('report'); + $task = $this->loadModel('testtask')->getById($taskID); + foreach($this->lang->testtask->report->charts as $chart => $title) + { + if(strpos($chart, 'testTask') === false) continue; + + $chartFunc = 'getDataOf' . $chart; + $chartData = $this->testtask->$chartFunc($taskID); + $chartOption = $this->testtask->mergeChartOption($chart); + if(!empty($chartType)) $chartOption->type = $chartType; + + $this->view->charts[$chart] = $chartOption; + $this->view->datas[$chart] = $this->report->computePercent($chartData); + } + } } diff --git a/module/testreport/view/blockbugreport.html.php b/module/testreport/view/blockbugreport.html.php index c5acb1ac11..232a061728 100644 --- a/module/testreport/view/blockbugreport.html.php +++ b/module/testreport/view/blockbugreport.html.php @@ -1,4 +1,50 @@ + $chartOption):?> + + + + $infoValue):?>
+ + + + + + + + + + + +
+
testtask->report->charts[$chartType];?>
+ testreport->none;?> +
+
+
testtask->report->charts[$chartType];?>
+
+
+
+
+ + + + + + + + + $data):?> + + + + + + + +
report->item;?>report->value;?>report->percent;?>
name;?>value;?>percent * 100) . '%';?>
+
+
+