From 4e88cce11af8ee187bb885b8c36945febfcef77f Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 9 Jan 2024 13:21:22 +0800 Subject: [PATCH] * Fix bug #41937. --- module/product/js/browse.ui.js | 10 +++++++--- module/product/lang/de.php | 8 ++++---- module/product/lang/en.php | 6 +++--- module/product/lang/fr.php | 6 +++--- module/product/lang/zh-cn.php | 6 +++--- module/product/model.php | 10 +++++----- module/product/test/model/summary.php | 24 ++++++++++++------------ 7 files changed, 37 insertions(+), 33 deletions(-) diff --git a/module/product/js/browse.ui.js b/module/product/js/browse.ui.js index de924dd5d0..94df202703 100644 --- a/module/product/js/browse.ui.js +++ b/module/product/js/browse.ui.js @@ -84,11 +84,12 @@ window.setStatistics = function(element, checkedIdList, pageSummary) { if(checkedIdList.length == 0) return {html: pageSummary}; - let total = checkedIdList.length; + let total = 0; + let SRTotal = 0; let estimate = 0; let rate = '0%'; let hasCase = 0; - let rateCount = total; + let rateCount = checkedIdList.length; const rows = element.layout.allRows; rows.forEach((row) => { @@ -104,10 +105,13 @@ window.setStatistics = function(element, checkedIdList, pageSummary) { rateCount -= 1; } + + if(storyType == story.type) total += 1; + if(storyType == 'requirement' && story.type == 'story') SRTotal += 1; } }) if(rateCount) rate = Math.round(hasCase / rateCount * 10000 / 100) + '' + '%'; - return {html: checkedSummary.replace('%total%', total).replace('%estimate%', estimate).replace('%rate%', rate)}; + return {html: checkedSummary.replace('%total%', total).replace('%estimate%', estimate).replace('%rate%', rate).replace('%SRTotal%', SRTotal)}; }; diff --git a/module/product/lang/de.php b/module/product/lang/de.php index d695d29821..844e0638ba 100644 --- a/module/product/lang/de.php +++ b/module/product/lang/de.php @@ -217,10 +217,10 @@ $lang->product->abbr->aclList['open'] = 'Default'; $lang->product->aclTips['open'] = "Benutzer mit Rechten für {$lang->productCommon} können zugreifen."; $lang->product->aclTips['private'] = "{$lang->executionCommon} Nur Teammitglieder"; -$lang->product->storySummary = " %s %s, %s Stunde(n) geplant, Fallabdeckung ist %s auf dieser Seite."; -$lang->product->checkedSRSummary = " %total% geprüft, %estimate% Stunde(n) geplant, Fallabdeckung ist %rate%."; -$lang->product->requirementSummary = " %s %s, %s Stunde(n) geplant."; -$lang->product->checkedURSummary = " %total% geprüft, %estimate% Stunde(n) geplant."; +$lang->product->storySummary = " %s {$lang->SRCommon}, %s Stunde(n) geplant, Fallabdeckung ist %s auf dieser Seite."; +$lang->product->checkedSRSummary = " %total% {$lang->SRCommon}, %estimate% Stunde(n) geplant, Fallabdeckung ist %rate%."; +$lang->product->requirementSummary = " %s {$lang->URCommon}, %s {$lang->SRCommon}, %s Stunde(n) geplant."; +$lang->product->checkedURSummary = " %total% {$lang->URCommon}, %SRTotal% {$lang->SRCommon}, %estimate% Stunde(n) geplant."; $lang->product->noModule = '
Kein Modul
Jetzt verwalten
'; $lang->product->noProduct = 'Kein Produkt. '; $lang->product->noMatched = '"%s" kann nicht gefunden werden.' . $lang->productCommon; diff --git a/module/product/lang/en.php b/module/product/lang/en.php index 565379576b..17cc2d55ae 100644 --- a/module/product/lang/en.php +++ b/module/product/lang/en.php @@ -217,10 +217,10 @@ $lang->product->abbr->aclList['open'] = 'Default'; $lang->product->aclTips['open'] = "Users with privileges to {$lang->productCommon} can access it."; $lang->product->aclTips['private'] = "{$lang->executionCommon} team members only"; -$lang->product->storySummary = "Total %s %s on this page. Estimates: %s ({$lang->hourCommon}), and Case Coverage: %s."; +$lang->product->storySummary = "Total %s {$lang->SRCommon} on this page. Estimates: %s ({$lang->hourCommon}), and Case Coverage: %s."; $lang->product->checkedSRSummary = "%total% {$lang->SRCommon} selected, Esitmates: %estimate% ({$lang->hourCommon}), and Case Coverage: %rate%."; -$lang->product->requirementSummary = "Total %s %s on this page. Estimates: %s ({$lang->hourCommon})."; -$lang->product->checkedURSummary = "%total% {$lang->URCommon} selected, Esitmates: %estimate% ({$lang->hourCommon})."; +$lang->product->requirementSummary = "Total %s {$lang->URCommon}, %s {$lang->SRCommon} on this page. Estimates: %s ({$lang->hourCommon})."; +$lang->product->checkedURSummary = "%total% {$lang->URCommon}, %SRTotal% {$lang->SRCommon} selected, Esitmates: %estimate% ({$lang->hourCommon})."; $lang->product->noModule = '
You have no modules.
Manage Now
'; $lang->product->noProduct = "No {$lang->productCommon} yet. "; $lang->product->noMatched = '"%s" cannot be found.' . $lang->productCommon; diff --git a/module/product/lang/fr.php b/module/product/lang/fr.php index 7aead83a6e..787a695eaf 100644 --- a/module/product/lang/fr.php +++ b/module/product/lang/fr.php @@ -217,10 +217,10 @@ $lang->product->abbr->aclList['open'] = 'Défaut'; $lang->product->aclTips['open'] = "Les utilisateurs ayant des droits sur {$lang->productCommon} peuvent accéder à ce {$lang->productCommon}."; $lang->product->aclTips['private'] = "les membres de l'équipe et les membres de la Liste blanche peuvent y accéder."; -$lang->product->storySummary = "Total de %s %s sur cette page. Estimé: %s (h), et couverture de la recette: %s."; +$lang->product->storySummary = "Total de %s {$lang->SRCommon} sur cette page. Estimé: %s (h), et couverture de la recette: %s."; $lang->product->checkedSRSummary = "%total% {$lang->SRCommon} sélectionnées, Estimé: %estimate%, et couverture de la recette: %rate%."; -$lang->product->requirementSummary = "Total de %s %s sur cette page. Estimé: %s (h),."; -$lang->product->checkedURSummary = "%total% {$lang->URCommon} sélectionnées, Estimé: %estimate%,."; +$lang->product->requirementSummary = "Total de %s {$lang->URCommon}, %s {$lang->SRCommon} sur cette page. Estimé: %s (h),."; +$lang->product->checkedURSummary = "%total% {$lang->URCommon}, %SRTotal% {$lang->SRCommon} sélectionnées, Estimé: %estimate%,."; $lang->product->noModule = "
Vous n'avez aucun modules.
Gérer Maintenant
"; $lang->product->noProduct = "No {$lang->productCommon} à ce jour. "; $lang->product->noMatched = '"%s" cannot be found.' . $lang->productCommon; diff --git a/module/product/lang/zh-cn.php b/module/product/lang/zh-cn.php index 156b947c69..b85d4049bc 100644 --- a/module/product/lang/zh-cn.php +++ b/module/product/lang/zh-cn.php @@ -217,10 +217,10 @@ $lang->product->abbr->aclList['open'] = '公开'; $lang->product->aclTips['open'] = "有{$lang->productCommon}视图权限,即可访问"; $lang->product->aclTips['private'] = "{$lang->productCommon}相关负责人、所属项目集的干系人、相关联{$lang->projectCommon}的团队成员和干系人可访问"; -$lang->product->storySummary = "本页共 %s 个%s,预计 %s 个{$lang->hourCommon},用例覆盖率 %s。"; +$lang->product->storySummary = "本页共 %s 个{$lang->SRCommon},预计 %s 个{$lang->hourCommon},用例覆盖率 %s。"; $lang->product->checkedSRSummary = "选中 %total% 个{$lang->SRCommon},预计 %estimate% 个{$lang->hourCommon},用例覆盖率 %rate%。"; -$lang->product->requirementSummary = "本页共 %s 个%s,预计 %s 个{$lang->hourCommon}。"; -$lang->product->checkedURSummary = "选中 %total% 个{$lang->URCommon},预计 %estimate% 个{$lang->hourCommon}。"; +$lang->product->requirementSummary = "本页共 %s 个{$lang->URCommon},%s个{$lang->SRCommon},预计 %s 个{$lang->hourCommon}。"; +$lang->product->checkedURSummary = "选中 %total% 个{$lang->URCommon},%SRTotal%个{$lang->SRCommon},预计 %estimate% 个{$lang->hourCommon}。"; $lang->product->noModule = "
您现在还没有模块信息
请维护模块
"; $lang->product->noProduct = "暂时没有{$lang->productCommon}。"; $lang->product->noMatched = '找不到包含"%s"的' . $lang->productCommon; diff --git a/module/product/model.php b/module/product/model.php index ba1193dd6d..ba1eac2d6f 100755 --- a/module/product/model.php +++ b/module/product/model.php @@ -1187,8 +1187,10 @@ class productModel extends model $rateCount = 0; $allCount = 0; + $SRTotal = 0; foreach($stories as $story) { + if($storyType == 'requirement' && $story->type == 'story') $SRTotal += 1; if(!empty($story->type) && $story->type != $storyType) continue; $totalEstimate += $story->estimate; @@ -1204,6 +1206,7 @@ class productModel extends model if(empty($story->children)) continue; foreach($story->children as $child) { + if($storyType == 'requirement' && $child->type == 'story') $SRTotal += 1; if($child->type != $storyType) continue; $allCount ++; @@ -1218,11 +1221,8 @@ class productModel extends model $casesCount = count($this->productTao->filterNoCasesStory($storyIdList)); $rate = empty($stories) || $rateCount == 0 ? 0 : round($casesCount / $rateCount, 2); - $storyCommon = $this->lang->SRCommon; - if($storyType == 'requirement') $storyCommon = $this->lang->URCommon; - - $summary = $storyType == 'story' ? $this->lang->product->storySummary : $this->lang->product->requirementSummary; - return sprintf($summary, $allCount, $storyCommon, $totalEstimate, $rate * 100 . "%"); + if($storyType == 'story') return sprintf($this->lang->product->storySummary, $allCount, $totalEstimate, $rate * 100 . "%"); + return sprintf($this->lang->product->requirementSummary, $allCount, $SRTotal, $totalEstimate); } /** diff --git a/module/product/test/model/summary.php b/module/product/test/model/summary.php index eca6f1398d..e2775a1f80 100644 --- a/module/product/test/model/summary.php +++ b/module/product/test/model/summary.php @@ -7,14 +7,14 @@ title=productModel->summary(); cid=0 - 获取正确的产品的需求统计 @本页共 2 个研发需求,预计 10 个工时,用例覆盖率 50%%。 -- 获取正确的产品的需求统计 @本页共 1 个用户需求,预计 1 个工时。 -- 获取正确的产品的需求统计 @本页共 0 个研发需求,预计 0 个工时。 +- 获取正确的产品的需求统计 @本页共 1 个用户需求,0个研发需求,预计 1 个工时。 +- 获取正确的产品的需求统计 @本页共 0 个用户需求,0个研发需求,预计 0 个工时。 - 获取空的产品的需求统计 @本页共 0 个研发需求,预计 0 个工时,用例覆盖率 0%%。 -- 获取空的产品的需求统计 @本页共 0 个用户需求,预计 0 个工时。 -- 获取空的产品的需求统计 @本页共 0 个研发需求,预计 0 个工时。 +- 获取空的产品的需求统计 @本页共 0 个用户需求,0个研发需求,预计 0 个工时。 +- 获取空的产品的需求统计 @本页共 0 个用户需求,0个研发需求,预计 0 个工时。 - 获取错误的产品的需求统计 @本页共 0 个研发需求,预计 0 个工时,用例覆盖率 0%%。 -- 获取错误的产品的需求统计 @本页共 0 个用户需求,预计 0 个工时。 -- 获取错误的产品的需求统计 @本页共 0 个研发需求,预计 0 个工时。 +- 获取错误的产品的需求统计 @本页共 0 个用户需求,0个研发需求,预计 0 个工时。 +- 获取错误的产品的需求统计 @本页共 0 个用户需求,0个研发需求,预计 0 个工时。 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; @@ -32,13 +32,13 @@ $typeList = array('story', 'requirement', 'error'); $product = new productTest('admin'); r($product->summaryTest($productIDList[0], $typeList[0])) && p() && e('本页共 2 个研发需求,预计 10 个工时,用例覆盖率 50%%。'); // 获取正确的产品的需求统计 -r($product->summaryTest($productIDList[0], $typeList[1])) && p() && e('本页共 1 个用户需求,预计 1 个工时。'); // 获取正确的产品的需求统计 -r($product->summaryTest($productIDList[0], $typeList[2])) && p() && e('本页共 0 个研发需求,预计 0 个工时。'); // 获取正确的产品的需求统计 +r($product->summaryTest($productIDList[0], $typeList[1])) && p() && e('本页共 1 个用户需求,0个研发需求,预计 1 个工时。'); // 获取正确的产品的需求统计 +r($product->summaryTest($productIDList[0], $typeList[2])) && p() && e('本页共 0 个用户需求,0个研发需求,预计 0 个工时。'); // 获取正确的产品的需求统计 r($product->summaryTest($productIDList[1], $typeList[0])) && p() && e('本页共 0 个研发需求,预计 0 个工时,用例覆盖率 0%%。'); // 获取空的产品的需求统计 -r($product->summaryTest($productIDList[1], $typeList[1])) && p() && e('本页共 0 个用户需求,预计 0 个工时。'); // 获取空的产品的需求统计 -r($product->summaryTest($productIDList[1], $typeList[2])) && p() && e('本页共 0 个研发需求,预计 0 个工时。'); // 获取空的产品的需求统计 +r($product->summaryTest($productIDList[1], $typeList[1])) && p() && e('本页共 0 个用户需求,0个研发需求,预计 0 个工时。'); // 获取空的产品的需求统计 +r($product->summaryTest($productIDList[1], $typeList[2])) && p() && e('本页共 0 个用户需求,0个研发需求,预计 0 个工时。'); // 获取空的产品的需求统计 r($product->summaryTest($productIDList[2], $typeList[0])) && p() && e('本页共 0 个研发需求,预计 0 个工时,用例覆盖率 0%%。'); // 获取错误的产品的需求统计 -r($product->summaryTest($productIDList[2], $typeList[1])) && p() && e('本页共 0 个用户需求,预计 0 个工时。'); // 获取错误的产品的需求统计 -r($product->summaryTest($productIDList[2], $typeList[2])) && p() && e('本页共 0 个研发需求,预计 0 个工时。'); // 获取错误的产品的需求统计 +r($product->summaryTest($productIDList[2], $typeList[1])) && p() && e('本页共 0 个用户需求,0个研发需求,预计 0 个工时。'); // 获取错误的产品的需求统计 +r($product->summaryTest($productIDList[2], $typeList[2])) && p() && e('本页共 0 个用户需求,0个研发需求,预计 0 个工时。'); // 获取错误的产品的需求统计