Exclude case from other project when counting total case
This commit is contained in:
parent
0ce5c2076e
commit
a28ef40419
|
@ -108,7 +108,7 @@ public class ApiDefinitionService {
|
|||
public List<ApiDefinitionResult> list(ApiDefinitionRequest request) {
|
||||
request = this.initRequest(request, true, true);
|
||||
List<ApiDefinitionResult> resList = extApiDefinitionMapper.list(request);
|
||||
calculateResult(resList);
|
||||
calculateResult(resList, request.getProjectId());
|
||||
return resList;
|
||||
}
|
||||
|
||||
|
@ -839,21 +839,21 @@ public class ApiDefinitionService {
|
|||
public List<ApiDefinitionResult> listRelevance(ApiDefinitionRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
List<ApiDefinitionResult> resList = extApiDefinitionMapper.listRelevance(request);
|
||||
calculateResult(resList);
|
||||
calculateResult(resList, request.getProjectId());
|
||||
return resList;
|
||||
}
|
||||
|
||||
public List<ApiDefinitionResult> listRelevanceReview(ApiDefinitionRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
List<ApiDefinitionResult> resList = extApiDefinitionMapper.listRelevanceReview(request);
|
||||
calculateResult(resList);
|
||||
calculateResult(resList, request.getProjectId());
|
||||
return resList;
|
||||
}
|
||||
|
||||
public void calculateResult(List<ApiDefinitionResult> resList) {
|
||||
public void calculateResult(List<ApiDefinitionResult> resList, String projectId) {
|
||||
if (!resList.isEmpty()) {
|
||||
List<String> ids = resList.stream().map(ApiDefinitionResult::getId).collect(Collectors.toList());
|
||||
List<ApiComputeResult> results = extApiDefinitionMapper.selectByIds(ids);
|
||||
List<ApiComputeResult> results = extApiDefinitionMapper.selectByIds(ids, projectId);
|
||||
Map<String, ApiComputeResult> resultMap = results.stream().collect(Collectors.toMap(ApiComputeResult::getApiDefinitionId, Function.identity()));
|
||||
for (ApiDefinitionResult res : resList) {
|
||||
ApiComputeResult compRes = resultMap.get(res.getId());
|
||||
|
|
|
@ -17,7 +17,9 @@ public interface ExtApiDefinitionMapper {
|
|||
|
||||
List<ApiDefinitionResult> list(@Param("request") ApiDefinitionRequest request);
|
||||
|
||||
List<ApiComputeResult> selectByIds(@Param("ids") List<String> ids);
|
||||
//List<ApiComputeResult> selectByIds(@Param("ids") List<String> ids);
|
||||
|
||||
List<ApiComputeResult> selectByIds(@Param("ids") List<String> ids, @Param("projectId") String projectId);
|
||||
|
||||
int removeToGc(@Param("ids") List<String> ids);
|
||||
|
||||
|
|
|
@ -93,6 +93,7 @@
|
|||
CONCAT(FORMAT(SUM(IF (t2.`status`='success',1,0))/COUNT(t1.id)*100,2),'%') passRate
|
||||
FROM api_test_case t1
|
||||
LEFT JOIN api_definition_exec_result t2 ON t1.last_result_id=t2.id
|
||||
WHERE t1.project_id = #{projectId}
|
||||
group by t1.api_definition_id having t1.api_definition_id in
|
||||
<foreach collection="ids" item="v" separator="," open="(" close=")">
|
||||
#{v}
|
||||
|
|
Loading…
Reference in New Issue