Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRAD2-2817 #518

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public Map<String, ExecutionContext> partition(int gridSize) {
StudentSearchRequest searchRequest = getStudentSearchRequest();
long startTime = System.currentTimeMillis();
logger.debug("Filter Schools for archiving school reports");
boolean processAllReports = "ALL".equalsIgnoreCase(searchRequest.getActivityCode());

List<String> eligibleStudentSchoolDistricts = gradSchoolOfRecordFilter.filterSchoolOfRecords(searchRequest);
List<String> finalSchoolDistricts = eligibleStudentSchoolDistricts.stream().sorted().toList();
if(logger.isDebugEnabled()) {
Expand All @@ -59,7 +61,18 @@ public Map<String, ExecutionContext> partition(int gridSize) {
Long totalSchoolReporsCount = 0L;
List<String> reportTypes = searchRequest.getReportTypes();
Long schoolReportsCount = 0L;
if(!finalSchoolDistricts.isEmpty()) {

if(processAllReports) {
if (reportTypes != null && !reportTypes.isEmpty()) {
for (String reportType : reportTypes) {
schoolReportsCount += restUtils.getTotalReportsForProcessing(List.of(), reportType, summaryDTO);
}
}
School school = new School("ALL_SCHOOLS");
school.setNumberOfSchoolReports(schoolReportsCount);
summaryDTO.getSchools().add(school);
totalSchoolReporsCount += schoolReportsCount;
} else {
for (String schoolOfRecord : finalSchoolDistricts) {
if (reportTypes != null && !reportTypes.isEmpty()) {
for (String reportType : reportTypes) {
Expand All @@ -71,17 +84,8 @@ public Map<String, ExecutionContext> partition(int gridSize) {
summaryDTO.getSchools().add(school);
totalSchoolReporsCount += schoolReportsCount;
}
} else {
if (reportTypes != null && !reportTypes.isEmpty()) {
for (String reportType : reportTypes) {
schoolReportsCount += restUtils.getTotalReportsForProcessing(List.of(), reportType, summaryDTO);
}
}
School school = new School("ALL_SCHOOLS");
school.setNumberOfSchoolReports(schoolReportsCount);
summaryDTO.getSchools().add(school);
totalSchoolReporsCount += schoolReportsCount;
}

long endTime = System.currentTimeMillis();
long diff = (endTime - startTime)/1000;
logger.debug("Total {} schools after filters in {} sec", eligibleStudentSchoolDistricts.size(), diff);
Expand Down
Loading