fix(功能用例): 修复通过率更新不及时问题

--bug=1044302 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001044302
This commit is contained in:
guoyuqi 2024-07-22 19:45:33 +08:00 committed by Craftsman
parent 5a0b449ddf
commit b0bcbc6cb7
1 changed files with 4 additions and 0 deletions

View File

@ -35,6 +35,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -156,6 +157,9 @@ public class CaseReviewService {
} }
caseReviewDTO.setPassCount(passList.size()); caseReviewDTO.setPassCount(passList.size());
BigDecimal passRate = BigDecimal.valueOf(caseReviewDTO.getPassCount()).divide(BigDecimal.valueOf(caseReviewDTO.getCaseCount()), 2, RoundingMode.HALF_UP);
caseReviewDTO.setPassRate(passRate.multiply(BigDecimal.valueOf(100)));
List<CaseReviewFunctionalCase> unPassList = statusCaseMap.get(FunctionalCaseReviewStatus.UN_PASS.toString()); List<CaseReviewFunctionalCase> unPassList = statusCaseMap.get(FunctionalCaseReviewStatus.UN_PASS.toString());
if (unPassList == null) { if (unPassList == null) {
unPassList = new ArrayList<>(); unPassList = new ArrayList<>();