fix(测试跟踪): 评审用例编辑页状态显示不准确

--bug=1021802 --user=陈建星 【测试跟踪】同一个用例被多个评审关联,评审结果不更新 https://www.tapd.cn/55049933/s/1333740
This commit is contained in:
chenjianxing 2023-02-10 15:55:38 +08:00 committed by jianxing
parent 71e27a6354
commit 89ab0222c3
8 changed files with 28 additions and 16 deletions

View File

@ -142,7 +142,7 @@
test_case_review_test_case.update_time, test_case_review_test_case.review_id as reviewId, test_case_review_test_case.update_time, test_case_review_test_case.review_id as reviewId,
test_case.id as caseId, test_case.name, test_case.priority, test_case.test_id as testId, test_case.id as caseId, test_case.name, test_case.priority, test_case.test_id as testId,
test_case.type, test_case.node_path, test_case.num, test_case.type, test_case.node_path, test_case.num,
test_case.custom_num, test_case_review_test_case.status reviewStatus, test_case.custom_num, test_case_review_test_case.status review_status,
test_case.remark as remark, test_case.maintainer, test_case.steps as steps, test_case.node_id as nodeId, test_case.remark as remark, test_case.maintainer, test_case.steps as steps, test_case.node_id as nodeId,
test_case.project_id, test_case.project_id,
test_case_node.name as model, test_case.version_id test_case_node.name as model, test_case.version_id
@ -319,7 +319,7 @@
<select id="get" resultType="io.metersphere.dto.TestReviewCaseDTO"> <select id="get" resultType="io.metersphere.dto.TestReviewCaseDTO">
select test_case_review_test_case.id id, test_case_review_test_case.case_id caseId, select test_case_review_test_case.id id, test_case_review_test_case.case_id caseId,
test_case.remark, test_case.review_status reviewStatus, test_case.status status, test_case.*, test_case.remark, test_case_review_test_case.status review_status, test_case.status status, test_case.*,
test_case_review_test_case.*, test_case_node.name as model, project.name as projectName test_case_review_test_case.*, test_case_node.name as model, project.name as projectName
from test_case_review_test_case from test_case_review_test_case
inner join test_case on test_case_review_test_case.case_id = test_case.id inner join test_case on test_case_review_test_case.case_id = test_case.id
@ -346,7 +346,7 @@
select tcrtc.id as id, select tcrtc.id as id,
tcrtc.review_id as reviewId, tcrtc.review_id as reviewId,
test_case.id as caseId, test_case.name, test_case.priority, test_case.id as caseId, test_case.name, test_case.priority,
test_case.type, test_case.node_path, test_case.review_status, test_case.type, test_case.node_path, tcrtc.status,
test_case.remark as remark, test_case.maintainer, test_case.steps as steps, test_case.remark as remark, test_case.maintainer, test_case.steps as steps,
test_case.node_id as nodeId, test_case.node_id as nodeId,
test_case.prerequisite, test_case.step_description, test_case.expected_result, test_case.step_model test_case.prerequisite, test_case.step_description, test_case.expected_result, test_case.step_model

View File

@ -122,9 +122,7 @@ public class TestCaseCommentService {
if (!sTime.equals("null")) { if (!sTime.equals("null")) {
start = sdf.format(new Date(Long.parseLong(sTime))); start = sdf.format(new Date(Long.parseLong(sTime)));
} }
String context = StringUtils.EMPTY; return "测试评审任务通知:" + user.getName() + "" + start + "" + "'" + testCaseWithBLOBs.getName() + "'" + "添加评论:" + testCaseComment.getDescription();
context = "测试评审任务通知:" + user.getName() + "" + start + "" + "'" + testCaseWithBLOBs.getName() + "'" + "添加评论:" + testCaseComment.getDescription();
return context;
} }
public void delete(String commentId) { public void delete(String commentId) {
@ -132,6 +130,14 @@ public class TestCaseCommentService {
testCaseCommentMapper.deleteByPrimaryKey(commentId); testCaseCommentMapper.deleteByPrimaryKey(commentId);
} }
public void deleteByBelongIdAndCaseId(String caseId, String belongId) {
TestCaseCommentExample example = new TestCaseCommentExample();
example.createCriteria()
.andCaseIdEqualTo(caseId)
.andBelongIdEqualTo(belongId);
testCaseCommentMapper.deleteByExample(example);
}
public TestCaseComment edit(SaveCommentRequest request) { public TestCaseComment edit(SaveCommentRequest request) {
checkCommentOwner(request.getId()); checkCommentOwner(request.getId());
testCaseCommentMapper.updateByPrimaryKeySelective(request); testCaseCommentMapper.updateByPrimaryKeySelective(request);

View File

@ -131,6 +131,7 @@ public class TestReviewTestCaseService {
testCaseReviewTestCaseUsersExample.createCriteria().andReviewIdEqualTo(request.getReviewId()).andCaseIdEqualTo(testCaseReviewTestCase.getCaseId()); testCaseReviewTestCaseUsersExample.createCriteria().andReviewIdEqualTo(request.getReviewId()).andCaseIdEqualTo(testCaseReviewTestCase.getCaseId());
testCaseReviewTestCaseUsersMapper.deleteByExample(testCaseReviewTestCaseUsersExample); testCaseReviewTestCaseUsersMapper.deleteByExample(testCaseReviewTestCaseUsersExample);
} }
testCaseCommentService.deleteByBelongIdAndCaseId(testCaseReviewTestCase.getCaseId(), request.getReviewId());
return testCaseReviewTestCaseMapper.deleteByPrimaryKey(request.getId()); return testCaseReviewTestCaseMapper.deleteByPrimaryKey(request.getId());
} }

View File

@ -1,6 +1,5 @@
SET SESSION innodb_lock_wait_timeout = 7200; SET SESSION innodb_lock_wait_timeout = 7200;
-- 给历史的评审评论设置评审ID
-- 初始化数据 -- 初始化数据
INSERT INTO test_case_review_test_case_users INSERT INTO test_case_review_test_case_users
SELECT DISTINCT t1.case_id, t2.review_id, t2.user_id SELECT DISTINCT t1.case_id, t2.review_id, t2.user_id

View File

@ -1,5 +1,6 @@
SET SESSION innodb_lock_wait_timeout = 7200; SET SESSION innodb_lock_wait_timeout = 7200;
-- 给历史的评审评论设置评审ID
INSERT INTO test_case_comment (id, case_id, description, author, create_time, update_time, status, type, belong_id) INSERT INTO test_case_comment (id, case_id, description, author, create_time, update_time, status, type, belong_id)
SELECT UUID() AS id, tcc.case_id, tcc.description, tcc.author, tcc.create_time, tcc.update_time, tcc.status, tcc.type, tcrtc.review_id as belong_id SELECT UUID() AS id, tcc.case_id, tcc.description, tcc.author, tcc.create_time, tcc.update_time, tcc.status, tcc.type, tcrtc.review_id as belong_id
FROM test_case_comment tcc FROM test_case_comment tcc
@ -9,4 +10,10 @@ WHERE tcc.type = 'REVIEW';
-- 删除 belong_id 为 NULL 的历史数据 -- 删除 belong_id 为 NULL 的历史数据
DELETE FROM test_case_comment WHERE type = 'REVIEW' AND belong_id IS NULL; DELETE FROM test_case_comment WHERE type = 'REVIEW' AND belong_id IS NULL;
-- 历史数据 Prepare 的评审评论状态改为 null
UPDATE test_case_comment SET status = NULL WHERE status = 'Prepare' AND `type` = 'REVIEW';
-- 将评审用例历史数据的未评审改成评审中
UPDATE test_case_review_test_case SET status = 'Underway' WHERE status = 'Prepare';
SET SESSION innodb_lock_wait_timeout = DEFAULT; SET SESSION innodb_lock_wait_timeout = DEFAULT;

View File

@ -172,7 +172,6 @@ export default {
testCaseTemplate: {}, testCaseTemplate: {},
formLabelWidth: "100px", formLabelWidth: "100px",
isCustomFiledActive: false, isCustomFiledActive: false,
oldReviewStatus: "",
titleWith: 0, titleWith: 0,
relationGraphOpen: false, relationGraphOpen: false,
isCommentEmpty: true isCommentEmpty: true
@ -341,7 +340,6 @@ export default {
); );
this.isCustomFiledActive = true; this.isCustomFiledActive = true;
this.testCase = item; this.testCase = item;
this.oldReviewStatus = this.testCase.reviewStatus;
if (!this.testCase.actualResult) { if (!this.testCase.actualResult) {
// ,使 // ,使
this.testCase.actualResult = this.testCaseTemplate.actualResult; this.testCase.actualResult = this.testCaseTemplate.actualResult;
@ -364,8 +362,6 @@ export default {
this.loading = true; this.loading = true;
this.showDialog = true; this.showDialog = true;
//
this.oldReviewStatus = testCase.reviewStatus;
this.activeTab = "detail"; this.activeTab = "detail";
listenGoBack(this.handleClose); listenGoBack(this.handleClose);
let initFuc = this.getTestCase; let initFuc = this.getTestCase;

View File

@ -4,7 +4,7 @@
<span> <span>
{{ testCase.name }} {{ testCase.name }}
</span> </span>
<el-popover v-if="reviewerStatus" placement="right" trigger="hover"> <el-popover v-if="reviewerStatus && reviewerStatus.length > 0" placement="right" trigger="hover">
<div class="status-tip" v-for="item in reviewerStatus" :key="item.author"> <div class="status-tip" v-for="item in reviewerStatus" :key="item.author">
<span style="font-size: 14px;color: #909399;font-weight: bold"> <span style="font-size: 14px;color: #909399;font-weight: bold">

View File

@ -17,7 +17,7 @@
<status-edit ref="statusEdit" :plan-id="reviewId" <status-edit ref="statusEdit" :plan-id="reviewId"
:select-ids="new Set(Array.from(this.selectRows).map(row => row.id))" @refresh="initTableData"/> :select-ids="new Set(Array.from(this.selectRows).map(row => row.id))" @refresh="initTableData"/>
<ms-table <ms-table
v-loading="result.loading" v-loading="loading"
:field-key="tableHeaderKey" :field-key="tableHeaderKey"
:data="tableData" :data="tableData"
:condition="condition" :condition="condition"
@ -208,6 +208,7 @@ import {useStore} from "@/store";
import {getVersionFilters} from "@/business/utils/sdk-utils"; import {getVersionFilters} from "@/business/utils/sdk-utils";
import {getProjectMember, getProjectMemberUserFilter} from "@/api/user"; import {getProjectMember, getProjectMemberUserFilter} from "@/api/user";
import {TEST_REVIEW_CASE} from "metersphere-frontend/src/components/search/search-components"; import {TEST_REVIEW_CASE} from "metersphere-frontend/src/components/search/search-components";
import {getProjectApplicationConfig} from "@/api/project-application";
export default { export default {
name: "TestReviewTestCaseList", name: "TestReviewTestCaseList",
@ -230,7 +231,7 @@ export default {
headerItems: Test_Case_Review_Case_List, headerItems: Test_Case_Review_Case_List,
screenHeight: 'calc(100vh - 240px)', screenHeight: 'calc(100vh - 240px)',
tableLabel: [], tableLabel: [],
result: {}, loading: false,
condition: { condition: {
components: TEST_REVIEW_CASE components: TEST_REVIEW_CASE
}, },
@ -412,6 +413,7 @@ export default {
this.condition.nodeIds = this.selectNodeIds; this.condition.nodeIds = this.selectNodeIds;
if (this.reviewId) { if (this.reviewId) {
this.loading = true;
getTestReviewTestCase(this.currentPage, this.pageSize, this.condition) getTestReviewTestCase(this.currentPage, this.pageSize, this.condition)
.then((response) => { .then((response) => {
this.total = response.data.itemCount; this.total = response.data.itemCount;
@ -421,6 +423,7 @@ export default {
if (callback && callback instanceof Function) { if (callback && callback instanceof Function) {
callback(); callback();
} }
this.loading = false;
}); });
this.getNexPageData(); this.getNexPageData();
} }