From 7de75f5fc13c6f27dd48891add0c46efca7bf18a Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 21 Mar 2017 16:53:55 +0800 Subject: [PATCH] * adjust for create bug from case. --- module/bug/model.php | 33 ++++++++++++++------------- module/testcase/model.php | 2 +- module/testtask/control.php | 4 +++- module/testtask/js/runcase.js | 19 +++++++++++---- module/testtask/view/results.html.php | 2 +- module/testtask/view/runcase.html.php | 2 +- 6 files changed, 38 insertions(+), 24 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index e032429723..d4abd354f0 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1397,34 +1397,35 @@ class bugModel extends model $bugSteps .= $this->lang->bug->tplStep; if(!empty($stepResults)) { - $i = 0; - foreach($caseSteps as $key => $step) + $i = 1; + foreach($steps as $stepId) { - if(!in_array($step->id, $steps)) continue; - $i++; + if(!isset($caseSteps[$stepId])) continue; + + $step = $caseSteps[$stepId]; $bugSteps .= $i . '. ' . $step->desc . "
"; + $i++; } $bugSteps .= $this->lang->bug->tplResult; - $i = 0; - foreach($caseSteps as $key => $step) + $i = 1; + foreach($steps as $stepId) { - if(!in_array($step->id, $steps)) continue; + if(!isset($stepResults[$stepId]) or empty($stepResults[$stepId]['real'])) continue; + $bugSteps .= $i . '. ' . $stepResults[$stepId]['real'] . "
"; $i++; - if(empty($stepResults[$step->id]['real'])) continue; - $bugSteps .= $i . '. ' . $stepResults[$step->id]['real'] . "
"; } $bugSteps .= $this->lang->bug->tplExpect; - $i = 0; - foreach($caseSteps as $key => $step) + $i = 1; + foreach($steps as $stepId) { - if(!in_array($step->id, $steps)) continue; - $i++; - if(!$step->expect) continue; - $bugSteps .= $i . '. ' . $step->expect . "
"; - } + if(!isset($caseSteps[$stepId])) continue; + $step = $caseSteps[$stepId]; + if($step->expect) $bugSteps .= $i . '. ' . $step->expect . "
"; + $i++; + } } return array('title' => $title, 'steps' => $bugSteps, 'storyID' => $run->case->story, 'moduleID' => $run->case->module, 'version' => $run->case->version); diff --git a/module/testcase/model.php b/module/testcase/model.php index 441b02a9cd..ce5ea82079 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -261,7 +261,7 @@ class testcaseModel extends model if($case->linkCase or $case->fromCaseID) $case->linkCaseTitles = $this->dao->select('id,title')->from(TABLE_CASE)->where('id')->in($case->linkCase)->orWhere('id')->eq($case->fromCaseID)->fetchPairs(); if($version == 0) $version = $case->version; - $case->steps = $this->dao->select('*')->from(TABLE_CASESTEP)->where('`case`')->eq($caseID)->andWhere('version')->eq($version)->orderBy('id')->fetchAll(); + $case->steps = $this->dao->select('*')->from(TABLE_CASESTEP)->where('`case`')->eq($caseID)->andWhere('version')->eq($version)->orderBy('id')->fetchAll('id'); $case->files = $this->loadModel('file')->getByObject('testcase', $caseID); $case->currentVersion = $version ? $version : $case->version; return $case; diff --git a/module/testtask/control.php b/module/testtask/control.php index ee3d67a720..df658f624d 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -875,7 +875,9 @@ 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(); - $this->view->build = isset($builds[$testtask->build]) ? $builds[$testtask->build] : ''; + + $this->view->build = isset($builds[$testtask->build]) ? $builds[$testtask->build] : ''; + $this->view->testtaskID = $testtaskID; } else { diff --git a/module/testtask/js/runcase.js b/module/testtask/js/runcase.js index ad02013d14..9f3ce5afd1 100644 --- a/module/testtask/js/runcase.js +++ b/module/testtask/js/runcase.js @@ -76,15 +76,26 @@ $(document).ready(function() $this.next('.result-detail').toggleClass('hide', !show); $this.find('.collapse-handle').toggleClass('icon-chevron-down', !show).toggleClass('icon-chevron-up', show); }); - - $('#casesResults table caption .result-tip').html($('#resultTip').html()); - $("#submit").text(caseResultSave); - $("#submit").attr({"disabled":"disabled"}); + $('#casesResults table caption .result-tip').html($('#resultTip').html()); + + $("#submit").text(caseResultSave); + $("#submit").attr({"disabled":"disabled"}); }); } } return false; }); + + $(document).on('click', ".step-group input[type='checkbox']", function() + { + var $next = $(this).closest('tr').next(); + while($next.length && $next.hasClass('step-item')) + { + var isChecked = $(this).prop('checked'); + $next.find("input[type='checkbox']").prop('checked', isChecked); + $next = $next.next(); + } + }); }); diff --git a/module/testtask/view/results.html.php b/module/testtask/view/results.html.php index 5c13175e87..0628aeeede 100644 --- a/module/testtask/view/results.html.php +++ b/module/testtask/view/results.html.php @@ -49,7 +49,7 @@ -
product&branch=$case->branch&extras=caseID=$case->id,version=$case->version,resultID=$result->id,runID=$runID")?>' target='_blank' method='post'> + product&branch=$case->branch&extras=caseID=$case->id,version=$case->version,resultID=$result->id,runID=$runID" . (isset($testtaskID) ? ",testtask=$testtaskID" : ''))?>' target='_blank' method='post'> diff --git a/module/testtask/view/runcase.html.php b/module/testtask/view/runcase.html.php index 3111a4b3bb..ad2ec7f6f5 100644 --- a/module/testtask/view/runcase.html.php +++ b/module/testtask/view/runcase.html.php @@ -42,7 +42,7 @@ $step->id = 0; $step->parent = 0; $step->case = $run->case->id; - $step->type = 'item'; + $step->type = 'step'; $step->desc = ''; $step->expect = ''; $run->case->steps[] = $step;