Skip to content

Commit

Permalink
GRAD2-2326: the deceased check query is enhanced to support paging.
Browse files Browse the repository at this point in the history
GRAD2-2326: the deceased check query is enhanced to support paging.
  • Loading branch information
infstar committed Sep 18, 2023
1 parent 97523a2 commit e5373bc
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,18 @@ public List<UUID> getStudentIDsByStatusCode(List<UUID> studentIDs, String status
if (StringUtils.isBlank(statusCode) || studentIDs.isEmpty()) {
return new ArrayList<>();
}
return graduationStatusRepository.filterGivenStudentsByStatusCode(studentIDs, statusCode);
List<UUID> results = new ArrayList<>();
int pageSize = 1000;
int pageNum = studentIDs.size() / pageSize + 1;
for (int i = 0; i < pageNum; i++) {
int startIndex = i * pageSize;
int endIndex = Math.min(startIndex + pageSize, studentIDs.size());
List<UUID> inputIDs = studentIDs.subList(startIndex, endIndex);
List<UUID> responseIDs = graduationStatusRepository.filterGivenStudentsByStatusCode(inputIDs, statusCode);
if (responseIDs != null && !responseIDs.isEmpty()) {
results.addAll(responseIDs);
}
}
return results;
}
}

0 comments on commit e5373bc

Please sign in to comment.