Merge branch 'sprint/180_songchenxuan_fix_code_review' into 'master'

*Code for code review.

See merge request easycorp/zentaopms!1287
This commit is contained in:
孙广明
2022-01-06 06:18:23 +00:00
11 changed files with 40 additions and 39 deletions
+1 -1
View File
@@ -2793,7 +2793,7 @@ class EndResponseException extends \Exception
/**
* @param string $content
*
* @return sellf
* @return self
*/
public static function create($content = '')
{
@@ -31,7 +31,7 @@
<th><?php echo $lang->block->totalStory . ':';?></th>
<td><?php echo $totalData[$projectID]->allStories;?></td>
<th><?php echo $lang->block->totalPeople . ':';?></th>
<td><?php echo $totalData[$projectID]->teamCount ? html::a($this->createLink('project', 'team', 'projectID=' . $projectID), $totalData[$projectID]->teamCount) : 0;?></td>
<td><?php echo $totalData[$projectID]->teamCount ? html::a($this->createLink('project', 'team', 'projectID=' . $projectID), $totalData[$projectID]->teamCount) : 0;?></td>
<th><?php echo $lang->block->estimatedHours . ':';?></th>
<td><?php echo $totalData[$projectID]->estimate . $lang->execution->workHour;?></td>
<th><?php echo $lang->block->totalBug. ':';?></th>
+1 -1
View File
@@ -2436,7 +2436,7 @@ class storyModel extends model
* @param int $productID
* @param string $type requirement|story
* @param string $orderBy
* @param string $pager
* @param object $pager
* @access public
* @return array
*/
+1 -1
View File
@@ -482,7 +482,7 @@
if(!isset($executions[$task->execution])) continue;
$executionName = $executions[$task->execution];
$taskInfo = $task->id . '&nbsp<span class="label label-success label-outline">' . $this->lang->task->statusList[$task->status] . '</span>&nbsp' . $task->name;
$class = isonlybody() ? 'showinonlybody' : 'iframe';
$class = isonlybody() ? 'showinonlybody' : 'iframe';
echo "<li title='$task->name'>" . html::a($this->createLink('task', 'view', "taskID=$task->id", '', true), $taskInfo, '', "class=$class data-width='80%'");
echo html::a($this->createLink('execution', 'browse', "executionID=$task->execution"), $executionName, '', "class='text-muted'") . '</li>';
}
+18 -13
View File
@@ -299,8 +299,10 @@ class testreport extends control
$this->view->reportTitle = date('Y-m-d') . " EXECUTION#{$execution->id} {$execution->name} {$this->lang->testreport->common}";
}
$cases = $this->testreport->getTaskCases($tasks, $begin, $end);
$bugInfo = $this->testreport->getBugInfo($tasks, $productIdList, $begin, $end, $builds);
$cases = $this->testreport->getTaskCases($tasks, $begin, $end);
list($bugInfo, $bugSummary) = $this->testreport->getBug4Report($tasks, $productIdList, $begin, $end, $builds);
$this->view->begin = $begin;
$this->view->end = $end;
$this->view->members = $this->dao->select('DISTINCT lastRunner')->from(TABLE_TESTRUN)->where('task')->in(array_keys($tasks))->fetchPairs('lastRunner', 'lastRunner');
@@ -329,9 +331,9 @@ class testreport extends control
$this->view->datas['testTaskPerRunResult'] = $this->loadModel('report')->computePercent($perCaseResult);
$this->view->datas['testTaskPerRunner'] = $this->report->computePercent($perCaseRunner);
$this->view->legacyBugs = $bugInfo['legacyBugs'];
unset($bugInfo['legacyBugs']);
$this->view->bugInfo = $bugInfo;
$this->view->bugInfo = $bugInfo;
$this->view->legacyBugs = $bugSummary['legacyBugs'];
$this->view->bugSummary = $bugSummary;
$this->view->objectID = $objectID;
$this->view->objectType = $objectType;
@@ -432,8 +434,9 @@ class testreport extends control
$bugs = $this->testreport->getBugs4Test($builds, $productIdList, $begin, $end, 'execution');
}
$cases = $this->testreport->getTaskCases($tasks, $begin, $end);
$bugInfo = $this->testreport->getBugInfo($tasks, $productIdList, $begin, $end, $builds);
$cases = $this->testreport->getTaskCases($tasks, $begin, $end);
list($bugInfo, $bugSummary) = $this->testreport->getBug4Report($tasks, $productIdList, $begin, $end, $builds);
$this->view->title = $report->title . $this->lang->testreport->edit;
@@ -458,9 +461,9 @@ class testreport extends control
$this->view->datas['testTaskPerRunResult'] = $this->loadModel('report')->computePercent($perCaseResult);
$this->view->datas['testTaskPerRunner'] = $this->report->computePercent($perCaseRunner);
$this->view->legacyBugs = $bugInfo['legacyBugs'];
unset($bugInfo['legacyBugs']);
$this->view->bugInfo = $bugInfo;
$this->view->legacyBugs = $bugSummary['legacyBugs'];
$this->view->bugInfo = $bugInfo;
$this->view->bugSummary = $bugSummary;
$this->display();
}
@@ -529,7 +532,8 @@ 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);
$bugInfo = $this->testreport->getBugInfo($tasks, $report->product, $report->begin, $report->end, $builds);
list($bugInfo, $bugSummary) = $this->testreport->getBug4Report($tasks, $report->product, $report->begin, $report->end, $builds);
/* save session .*/
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false);
@@ -566,9 +570,10 @@ class testreport extends control
$this->view->datas['testTaskPerRunResult'] = $this->loadModel('report')->computePercent($perCaseResult);
$this->view->datas['testTaskPerRunner'] = $this->report->computePercent($perCaseRunner);
$this->view->legacyBugs = $bugInfo['legacyBugs'];
unset($bugInfo['legacyBugs']);
$this->view->bugInfo = $bugInfo;
$this->view->legacyBugs = $bugSummary['legacyBugs'];
$this->view->bugSummary = $bugSummary;
$this->display();
}
+1 -1
View File
@@ -78,7 +78,7 @@ $lang->testreport->exportNotice = "Exported By <a href='https://www.zentao.ne
$lang->testreport->noReport = "No report has been generated. Please check it later.";
$lang->testreport->foundBugTip = "Bugs found in this build period and the affected build is in this test period.";
$lang->testreport->legacyBugTip = "Active bugs, or bugs that are not resolved in the test period.";
$lang->testreport->activatedBugTip = "Reactive bugs in the test period.";
$lang->testreport->activatedBugTip = "Reactived bugs during the testtask.";
$lang->testreport->fromCaseBugTip = "Bugs found from the running of cases in the test period.";
$lang->testreport->errorTrunk = "You cannot create a Testing report for the trunk. Please modify the linked build!";
$lang->testreport->noTestTask = "No test requests for this {$lang->productCommon}, so no reports can be generated. Please go to {$lang->productCommon} which has test requests and then generate the report.";
+11 -12
View File
@@ -125,7 +125,7 @@ class testreportModel extends model
}
/**
* Get bug info.
* Get bug info and summary.
*
* @param array $tasks
* @param array $productIdList
@@ -135,7 +135,7 @@ class testreportModel extends model
* @access public
* @return array
*/
public function getBugInfo($tasks, $productIdList, $begin, $end, $builds)
public function getBug4Report($tasks, $productIdList, $begin, $end, $builds)
{
$generatedBugs = $this->dao->select('*')->from(TABLE_BUG)->where('product')->in($productIdList)->andWhere('openedDate')->ge($begin)->andWhere('openedDate')->le("$end 23:59:59")->andWhere('deleted')->eq(0)->fetchAll();
$resolvedBugs = $this->dao->select('*')->from(TABLE_BUG)->where('product')->in($productIdList)->andWhere('resolvedDate')->ge($begin)->andWhere('resolvedDate')->le("$end 23:59:59")->andWhere('deleted')->eq(0)->fetchAll();
@@ -259,7 +259,6 @@ class testreportModel extends model
}
$resolvedBugs = 0;
$this->loadModel('action');
foreach($foundBugs as $bug)
{
$severityGroups[$bug->severity] = isset($severityGroups[$bug->severity]) ? $severityGroups[$bug->severity] + 1 : 1;
@@ -273,14 +272,14 @@ class testreportModel extends model
if($bug->status == 'resolved' or $bug->status == 'closed') $resolvedBugs ++;
}
$bugInfo['foundBugs'] = count($foundBugs);
$bugInfo['legacyBugs'] = $legacyBugs;
$bugInfo['activatedBugs'] = $activatedBugs;
$bugInfo['countBugByTask'] = $byCaseNum;
$bugInfo['bugConfirmedRate'] = empty($resolvedBugs) ? 0 : round((zget($resolutionGroups, 'fixed', 0) + zget($resolutionGroups, 'postponed', 0)) / $resolvedBugs * 100, 2);
$bugInfo['bugCreateByCaseRate'] = empty($byCaseNum) ? 0 : round($byCaseNum / count($foundBugs) * 100, 2);
$bugInfo['bugStageGroups'] = $isEmptyStage ? array() : $stageGroups;
$bugInfo['bugHandleGroups'] = $isEmptyHandle ? array() : $handleGroups;
$bugSummary['foundBugs'] = count($foundBugs);
$bugSummary['legacyBugs'] = $legacyBugs;
$bugSummary['activatedBugs'] = count($activatedBugs);
$bugSummary['countBugByTask'] = $byCaseNum;
$bugSummary['bugConfirmedRate'] = empty($resolvedBugs) ? 0 : round((zget($resolutionGroups, 'fixed', 0) + zget($resolutionGroups, 'postponed', 0)) / $resolvedBugs * 100, 2);
$bugSummary['bugCreateByCaseRate'] = empty($byCaseNum) ? 0 : round($byCaseNum / count($foundBugs) * 100, 2);
$bugInfo['bugStageGroups'] = $isEmptyStage ? array() : $stageGroups;
$bugInfo['bugHandleGroups'] = $isEmptyHandle ? array() : $handleGroups;
$this->app->loadLang('bug');
$users = $this->loadModel('user')->getPairs('noclosed|noletter|nodeleted');
@@ -351,7 +350,7 @@ class testreportModel extends model
}
$bugInfo['bugResolvedByGroups'] = $data;
return $bugInfo;
return array($bugInfo, $bugSummary);
}
/**
+1 -2
View File
@@ -83,8 +83,7 @@
<?php
echo '<div>' . $storySummary . '</div>';
echo '<div>' . sprintf($lang->testreport->buildSummary, empty($builds) ? 1 : count($builds)) . $caseSummary . '</div>';
echo '<div>' . sprintf($lang->testreport->bugSummary, $bugInfo['foundBugs'], count($legacyBugs), count($bugInfo['activatedBugs']), $bugInfo['countBugByTask'], $bugInfo['bugConfirmedRate'] . '%', $bugInfo['bugCreateByCaseRate'] . '%') . '</div>';
unset($bugInfo['countBugByTask']); unset($bugInfo['bugConfirmedRate']); unset($bugInfo['bugCreateByCaseRate']); unset($bugInfo['foundBugs']); unset($bugInfo['activatedBugs']);
echo '<div>' . sprintf($lang->testreport->bugSummary, $bugSummary['foundBugs'], count($legacyBugs), $bugSummary['activatedBugs'], $bugSummary['countBugByTask'], $bugSummary['bugConfirmedRate'] . '%', $bugSummary['bugCreateByCaseRate'] . '%') . '</div>';
?>
</td>
<td></td>
+1 -2
View File
@@ -71,8 +71,7 @@
<?php
echo '<p>' . $storySummary . '</p>';
echo '<p>' . sprintf($lang->testreport->buildSummary, empty($builds) ? 1 : count($builds)) . $caseSummary . '</p>';
echo '<p>' . sprintf($lang->testreport->bugSummary, $bugInfo['foundBugs'], count($legacyBugs), count($bugInfo['activatedBugs']), $bugInfo['countBugByTask'], $bugInfo['bugConfirmedRate'] . '%', $bugInfo['bugCreateByCaseRate'] . '%') . '</p>';
unset($bugInfo['countBugByTask']); unset($bugInfo['bugConfirmedRate']); unset($bugInfo['bugCreateByCaseRate']); unset($bugInfo['foundBugs']); unset($bugInfo['activatedBugs']);
echo '<p>' . sprintf($lang->testreport->bugSummary, $bugSummary['foundBugs'], count($legacyBugs), $bugSummary['activatedBugs'], $bugSummary['countBugByTask'], $bugSummary['bugConfirmedRate'] . '%', $bugSummary['bugCreateByCaseRate'] . '%') . '</p>';
?>
</td>
<td></td>
+1 -2
View File
@@ -78,8 +78,7 @@
<?php
echo '<p>' . $storySummary . '</p>';
echo '<p>' . sprintf($lang->testreport->buildSummary, empty($builds) ? 1 : count($builds)) . $caseSummary . '</p>';
echo '<p>' . sprintf($lang->testreport->bugSummary, $bugInfo['foundBugs'], count($legacyBugs), count($bugInfo['activatedBugs']), $bugInfo['countBugByTask'], $bugInfo['bugConfirmedRate'] . '%', $bugInfo['bugCreateByCaseRate'] . '%') . '</p>';
unset($bugInfo['countBugByTask']); unset($bugInfo['bugConfirmedRate']); unset($bugInfo['bugCreateByCaseRate']); unset($bugInfo['foundBugs']); unset($bugInfo['activatedBugs']);
echo '<p>' . sprintf($lang->testreport->bugSummary, $bugSummary['foundBugs'], count($legacyBugs), $bugSummary['activatedBugs'], $bugSummary['countBugByTask'], $bugSummary['bugConfirmedRate'] . '%', $bugSummary['bugCreateByCaseRate'] . '%') . '</p>';
?>
</td>
</tr>
+3 -3
View File
@@ -242,8 +242,8 @@ class treeModel extends model
public function getTaskOptionMenu($rootID, $productID = 0, $startModule = 0, $extra = '')
{
/* If createdVersion <= 4.1, go to getOptionMenu(). */
$products = $this->loadModel('product')->getProductPairsByProject($rootID);
$branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products), 'noclosed');
$products = $this->loadModel('product')->getProductPairsByProject($rootID);
$branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products), 'noclosed');
if(!$this->isMergeModule($rootID, 'task') or !$products) return $this->getOptionMenu($rootID, 'task', $startModule);
@@ -282,7 +282,7 @@ class treeModel extends model
{
$modules = $this->dao->select('*')->from(TABLE_MODULE)->where("((root = '" . (int)$rootID . "' and type = 'task' and parent != 0) OR (root = $id and type = 'story'))")
->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi()
->beginIF(!empty($activeBranch))->andWhere('branch')->in($activeBranch)->fi()
->andWhere('branch')->in($activeBranch)->fi()
->andWhere('deleted')->eq(0)
->orderBy('grade desc, branch, `order`, type')
->fetchAll('id');