Skip to content

Commit

Permalink
Bug/Vas-11649: handle wrong stats on accession register v6
Browse files Browse the repository at this point in the history
  • Loading branch information
bbenaissa committed Sep 15, 2023
1 parent 54061d0 commit 384ddb2
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ public PaginatedValuesDto<AccessionRegisterDetailDto> getAllPaginated(
//Constructing json query for Vitam
LOGGER.debug("List of Accession Registers EvIdAppSession : {} ", vitamContext.getApplicationSessionId());
JsonNode query;
AccessionRegisterSearchDto accessionRegisterSearchDto;
try {
AccessionRegisterSearchDto accessionRegisterSearchDto = criteria.isPresent() ?
accessionRegisterSearchDto = criteria.isPresent() ?
objectMapper.readValue(criteria.get(), AccessionRegisterSearchDto.class) :
new AccessionRegisterSearchDto();
query = AccessRegisterVitamQueryHelper.createQueryDSL(
Expand Down Expand Up @@ -165,9 +166,18 @@ public PaginatedValuesDto<AccessionRegisterDetailDto> getAllPaginated(
value.setOriginatingAgencyLabel(agenciesMap.get(value.getOriginatingAgency()));
value.setSubmissionAgencyLabel(agenciesMap.get(value.getSubmissionAgency()));
});
Map<String, Object> optionalValues = new HashMap<>();
if (hasMore || pageNumber > 0) {
try {
query = AccessRegisterVitamQueryHelper.createQueryDSL(accessionRegisterSearchDto, 0, 10000, null, null);
} catch (InvalidCreateOperationException | InvalidParseOperationException e) {
throw new InternalServerException("Can't create dsl query to get paginated accession registers", e);
}
//fetching all 10000 elements as another query to compute statistics as quick solution
results = fetchingAllPaginatedDataFromVitam(vitamContext, query);
}

//Build statistique datas
Map<String, Object> optionalValues = new HashMap<>();
AccessionRegisterStatsDto statsDto = AccessRegisterStatsHelper.fetchStats(results.getResults());
optionalValues.put("stats", statsDto);

Expand Down

0 comments on commit 384ddb2

Please sign in to comment.