Skip to content

Commit

Permalink
Merge pull request #517 from bcgov/develop/alex-GRAD2-2817
Browse files Browse the repository at this point in the history
GRAD2-2817
  • Loading branch information
arybakov-cgi authored Aug 29, 2024
2 parents f7ffa4e + e8904b5 commit cdae35d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class StudentSearchRequest implements Serializable {
Boolean validateInput;
String activityCode;
String localDownload;
Integer quantity;

public boolean isEmpty() {
return schoolOfRecords.isEmpty() &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public Map<String, ExecutionContext> partition(int gridSize) {
long startTime = System.currentTimeMillis();
logger.debug("Filter Schools for deleting student reports");
boolean processAllReports = "ALL".equalsIgnoreCase(searchRequest.getActivityCode());
int quantity = ((searchRequest.getQuantity() == null) || (searchRequest.getQuantity() == 0)) ? DEFAULT_ROW_COUNT : searchRequest.getQuantity();
Long batchId = jobExecution.getId();;
List<String> eligibleStudentSchoolDistricts = gradSchoolOfRecordFilter.filterSchoolOfRecords(searchRequest);
List<String> finalSchoolDistricts = eligibleStudentSchoolDistricts.stream().sorted().toList();
Expand All @@ -67,8 +68,9 @@ public Map<String, ExecutionContext> partition(int gridSize) {
if(processAllReports) {
for(String reportType: searchRequest.getReportTypes()) {
Long studentReportsCount = restUtils.getTotalReportsForProcessing(List.of(), reportType, distributionSummaryDTO);
Integer guidsRowCount = Integer.min(studentReportsCount.intValue(), DEFAULT_ROW_COUNT);
Integer guidsRowCount = Integer.min(studentReportsCount.intValue(), quantity);
totalStudentReportsCount += guidsRowCount;
updateBatchJobHistory(algorithmJobHistory, totalStudentReportsCount);
List<UUID> reportTypeGuids = restUtils.getReportStudentIDsByStudentIDsAndReportType(List.of(), reportType, guidsRowCount, distributionSummaryDTO);
finalStudentGuids.addAll(reportTypeGuids);
}
Expand All @@ -77,15 +79,14 @@ public Map<String, ExecutionContext> partition(int gridSize) {
List<String> studentGuidsBySearchString = studentGuidsBySearch.stream().map(UUID::toString).toList();
for(String reportType: searchRequest.getReportTypes()) {
Long studentReportsCount = restUtils.getTotalReportsForProcessing(studentGuidsBySearchString, reportType, distributionSummaryDTO);
Integer guidsRowCount = Integer.min(studentReportsCount.intValue(), DEFAULT_ROW_COUNT);
Integer guidsRowCount = Integer.min(studentReportsCount.intValue(), quantity);
totalStudentReportsCount += guidsRowCount;
updateBatchJobHistory(algorithmJobHistory, totalStudentReportsCount);
List<UUID> reportTypeGuids = restUtils.getReportStudentIDsByStudentIDsAndReportType(studentGuidsBySearchString, reportType, guidsRowCount, distributionSummaryDTO);
finalStudentGuids.addAll(reportTypeGuids);
}
}

updateBatchJobHistory(algorithmJobHistory, totalStudentReportsCount);

searchRequest.setStudentIDs(finalStudentGuids);
distributionSummaryDTO.setBatchId(batchId);
distributionSummaryDTO.setStudentSearchRequest(searchRequest);
Expand Down

0 comments on commit cdae35d

Please sign in to comment.