fix(用例管理): 修复脑图排序失败问题

--bug=1048868 --user=郭雨琦 修复脑图排序失败问题
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001048868
This commit is contained in:
guoyuqi 2024-11-15 13:44:58 +08:00 committed by Craftsman
parent e9fa95b1e9
commit 7fa8185aaa
2 changed files with 3 additions and 5 deletions

View File

@ -575,12 +575,12 @@ public class FunctionalCaseMinderService {
afterNode = sources; afterNode = sources;
} else { } else {
if (StringUtils.equals(moveMode, MoveTypeEnum.AFTER.name())) { if (StringUtils.equals(moveMode, MoveTypeEnum.AFTER.name())) {
if (targetIndex + 1 > sources.size()) { if (targetIndex > sources.size()) {
beforeNode = sources; beforeNode = sources;
afterNode = new ArrayList<>(); afterNode = new ArrayList<>();
} else { } else {
beforeNode = sources.subList(0, targetIndex + 1); beforeNode = sources.subList(0, targetIndex-1);
afterNode = sources.subList(targetIndex + 1, sources.size()); afterNode = sources.subList(targetIndex-1, sources.size());
} }
} else { } else {
beforeNode = sources.subList(0, targetIndex); beforeNode = sources.subList(0, targetIndex);

View File

@ -336,7 +336,6 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
functionalCaseExample.createCriteria().andNameEqualTo("新增用例"); functionalCaseExample.createCriteria().andNameEqualTo("新增用例");
functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample); functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample);
Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases)); Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases));
Assertions.assertTrue(functionalCases.getFirst().getPos() > 0L);
Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases)); Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases));
customFieldExample = new FunctionalCaseCustomFieldExample(); customFieldExample = new FunctionalCaseCustomFieldExample();
@ -347,7 +346,6 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
functionalCaseModuleExample.createCriteria().andNameEqualTo("新增9"); functionalCaseModuleExample.createCriteria().andNameEqualTo("新增9");
List<FunctionalCaseModule> functionalCaseModules = functionalCaseModuleMapper.selectByExample(functionalCaseModuleExample); List<FunctionalCaseModule> functionalCaseModules = functionalCaseModuleMapper.selectByExample(functionalCaseModuleExample);
Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCaseModules)); Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCaseModules));
Assertions.assertTrue(functionalCaseModules.getFirst().getPos() > 0L);
request = new FunctionalCaseMinderEditRequest(); request = new FunctionalCaseMinderEditRequest();
request.setProjectId("project-case-minder-test"); request.setProjectId("project-case-minder-test");
request.setVersionId("ffff"); request.setVersionId("ffff");