Skip to content

Commit

Permalink
Merge pull request #575 from bcgov/feature/GRAD2-2326
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
kamal-mohammed authored Sep 18, 2023
2 parents 97523a2 + e5373bc commit 67b9a64
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 67b9a64

Please sign in to comment.