fix(任务中心): 修复任务数量统计和实际执行数不一致问题

--bug=1010583 --user=赵勇 【任务中心】-执行测试计划包括20个用例-任务中心只显示当前页的正在执行的用例数,实际有20个正在执行 https://www.tapd.cn/55049933/s/1109348
This commit is contained in:
fit2-zhao 2022-02-24 10:29:05 +08:00 committed by fit2-zhao
parent 60221bd4e9
commit 6f2ceff67a
2 changed files with 7 additions and 17 deletions

View File

@ -40,12 +40,14 @@ public class JmeterThreadUtils {
Thread[] lstThreads = new Thread[noThreads]; Thread[] lstThreads = new Thread[noThreads];
currentGroup.enumerate(lstThreads); currentGroup.enumerate(lstThreads);
for (int i = 0; i < noThreads; i++) { for (int i = 0; i < noThreads; i++) {
if (lstThreads[i] != null) {
if (StringUtils.isNotEmpty(reportId) && StringUtils.isNotEmpty(lstThreads[i].getName()) && lstThreads[i].getName().startsWith(reportId)) { if (StringUtils.isNotEmpty(reportId) && StringUtils.isNotEmpty(lstThreads[i].getName()) && lstThreads[i].getName().startsWith(reportId)) {
return true; return true;
} else if (StringUtils.isNotEmpty(testId) && StringUtils.isNotEmpty(lstThreads[i].getName()) && lstThreads[i].getName().startsWith(testId)) { } else if (StringUtils.isNotEmpty(testId) && StringUtils.isNotEmpty(lstThreads[i].getName()) && lstThreads[i].getName().startsWith(testId)) {
return true; return true;
} }
} }
}
return false; return false;
} }
} }

View File

@ -398,17 +398,6 @@ export default {
getTaskRunning() { getTaskRunning() {
this.initWebSocket(); this.initWebSocket();
}, },
calculationRunningTotal() {
if (this.taskData) {
let total = 0;
this.taskData.forEach(item => {
if (this.getPercentage(item.executionStatus) !== 100 && this.getPercentage(item.executionStatus) !== 0) {
total++;
}
});
this.runningTotal = total;
}
},
init() { init() {
if (this.showType === "CASE" || this.showType === "SCENARIO") { if (this.showType === "CASE" || this.showType === "SCENARIO") {
return; return;
@ -417,7 +406,6 @@ export default {
this.result = this.$post('/task/center/list/' + this.currentPage + '/' + this.pageSize, this.condition, response => { this.result = this.$post('/task/center/list/' + this.currentPage + '/' + this.pageSize, this.condition, response => {
this.total = response.data.itemCount; this.total = response.data.itemCount;
this.taskData = response.data.listObject; this.taskData = response.data.listObject;
this.calculationRunningTotal();
this.initEnd = true; this.initEnd = true;
this.loading = false; this.loading = false;
}); });