fix(测试计划): 测试计划报告的通过率执行率精度改为小数点后2位
【【富国基金】测试计划报告通过率的计算,希望保留两位小数,不用四舍五入。】 https://www.tapd.cn/55049933/prong/stories/view/1155049933001012667
This commit is contained in:
parent
3822c100ac
commit
fef7e26254
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div v-loading="result.loading" v-if="threadGroups.length > 0" class="pressure-config-container">
|
||||
<div v-loading="result.loading" v-if="loadIsOver" class="pressure-config-container">
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form :inline="true" :disabled="isReadOnly">
|
||||
|
@ -320,6 +320,7 @@ export default {
|
|||
step: 0,
|
||||
rpsLimit: 0,
|
||||
rpsLimitEnable: false,
|
||||
loadIsOver: true,
|
||||
options: {},
|
||||
resourcePool: null,
|
||||
setPoolNull: false,
|
||||
|
@ -415,6 +416,7 @@ export default {
|
|||
getLoadConfig(this.testId, this.reportId, this.isShare)
|
||||
.then(response => {
|
||||
let data = JSON.parse(response.data);
|
||||
this.loadIsOver = false;
|
||||
for (let i = 0; i < this.threadGroups.length; i++) {
|
||||
data[i].forEach(item => {
|
||||
switch (item.key) {
|
||||
|
@ -509,6 +511,7 @@ export default {
|
|||
tg.durationMinutes = Math.floor((tg.duration / 60 % 60));
|
||||
tg.durationSeconds = Math.floor((tg.duration % 60));
|
||||
}
|
||||
this.loadIsOver = true;
|
||||
this.resourcePoolChange();
|
||||
this.calculateTotalChart();
|
||||
});
|
||||
|
|
|
@ -80,6 +80,7 @@ import java.io.InputStreamReader;
|
|||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Function;
|
||||
|
@ -1750,15 +1751,29 @@ public class TestPlanService {
|
|||
}
|
||||
issuesService.calculateReportByIssueList(testPlanCaseReportResultDTO.getIssueList(), report);
|
||||
|
||||
DecimalFormat rateFormat = new DecimalFormat("#0.00");
|
||||
rateFormat.setMinimumFractionDigits(2);
|
||||
rateFormat.setMaximumFractionDigits(2);
|
||||
|
||||
if (report.getExecuteCount() != 0 && report.getCaseCount() != null) {
|
||||
report.setExecuteRate(report.getExecuteCount() * 0.1 * 10 / report.getCaseCount());
|
||||
double executeRate = Double.parseDouble(rateFormat.format((double) report.getExecuteCount() / (double) report.getCaseCount()));
|
||||
if (executeRate == 1 && report.getExecuteCount() < report.getCaseCount()) {
|
||||
report.setExecuteRate(0.99);
|
||||
} else {
|
||||
report.setExecuteRate(0.0);
|
||||
report.setExecuteRate(executeRate);
|
||||
}
|
||||
} else {
|
||||
report.setExecuteRate(0.00);
|
||||
}
|
||||
if (report.getPassCount() != 0 && report.getCaseCount() != null) {
|
||||
report.setPassRate(report.getPassCount() * 0.1 * 10 / report.getCaseCount());
|
||||
double passRate = Double.parseDouble(rateFormat.format((double) report.getPassCount() / (double) report.getCaseCount()));
|
||||
if (passRate == 1 && report.getPassCount() < report.getCaseCount()) {
|
||||
report.setPassRate(0.99);
|
||||
} else {
|
||||
report.setPassRate(0.0);
|
||||
report.setPassRate(passRate);
|
||||
}
|
||||
} else {
|
||||
report.setPassRate(0.00);
|
||||
}
|
||||
|
||||
report.setName(testPlan.getName());
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
{{ resourcePool }}
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="8"> </el-col>
|
||||
<el-col :span="8"></el-col>
|
||||
</el-row>
|
||||
<el-row
|
||||
class="select-time"
|
||||
|
@ -70,7 +70,7 @@
|
|||
:label="$t('test_track.report.executive_finish_rate') + ':'"
|
||||
>
|
||||
{{
|
||||
(report.executeRate ? (report.executeRate * 100).toFixed(1) : 0) +
|
||||
(report.executeRate ? (report.executeRate * 100).toFixed(2) : 0) +
|
||||
"%"
|
||||
}}
|
||||
<ms-instructions-icon
|
||||
|
@ -81,7 +81,7 @@
|
|||
<el-col :span="8">
|
||||
<el-form-item :label="$t('test_track.report.passing_rate') + ':'">
|
||||
{{
|
||||
(report.passRate ? (report.passRate * 100).toFixed(1) : 0) + "%"
|
||||
(report.passRate ? (report.passRate * 100).toFixed(2) : 0) + "%"
|
||||
}}
|
||||
<ms-instructions-icon
|
||||
:content="$t('test_track.report.passing_rate_tip')"
|
||||
|
@ -98,7 +98,7 @@ import MsFormDivider from "metersphere-frontend/src/components/MsFormDivider";
|
|||
import TestPlanReportContainer from "@/business/plan/view/comonents/report/detail/TestPlanReportContainer";
|
||||
import MsInstructionsIcon from "metersphere-frontend/src/components/MsInstructionsIcon";
|
||||
import MsTag from "metersphere-frontend/src/components/MsTag";
|
||||
import { datetimeFormat } from "fit2cloud-ui/src/filters/time";
|
||||
import {datetimeFormat} from "fit2cloud-ui/src/filters/time";
|
||||
|
||||
export default {
|
||||
name: "TestPlanOverviewReport",
|
||||
|
|
Loading…
Reference in New Issue