From 14e9f1a430a29ceeaf61aa33cd5bb2a7893a7c17 Mon Sep 17 00:00:00 2001 From: arybakov Date: Wed, 20 Sep 2023 14:51:51 -0600 Subject: [PATCH] GRAD2-2308 HD-21581-GRAD - P3 - GRAD Batch Processing - Select Student Options moved to wrong place --- .../grad/report/model/dto/StudentSearchRequest.java | 2 ++ .../educ/api/grad/report/service/CommonService.java | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/grad/report/model/dto/StudentSearchRequest.java b/api/src/main/java/ca/bc/gov/educ/api/grad/report/model/dto/StudentSearchRequest.java index 07f08073..dcad7ff7 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/grad/report/model/dto/StudentSearchRequest.java +++ b/api/src/main/java/ca/bc/gov/educ/api/grad/report/model/dto/StudentSearchRequest.java @@ -8,6 +8,7 @@ import java.io.Serializable; import java.util.List; +import java.util.UUID; @Data @Component @@ -20,6 +21,7 @@ public class StudentSearchRequest implements Serializable { List schoolCategoryCodes; List pens; List programs; + private List studentIDs; Boolean validateInput; } diff --git a/api/src/main/java/ca/bc/gov/educ/api/grad/report/service/CommonService.java b/api/src/main/java/ca/bc/gov/educ/api/grad/report/service/CommonService.java index 795781c2..cd9c897b 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/grad/report/service/CommonService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/grad/report/service/CommonService.java @@ -505,12 +505,15 @@ public boolean updateStudentCredentialPosting(UUID studentID, String credentialT public List getStudentCredentialsForUserRequestDisRun(String credentialType, StudentSearchRequest studentSearchRequest, String accessToken) { List scdList = new ArrayList<>(); - List studentList = getStudentsForSpecialGradRun(studentSearchRequest, accessToken); - if (!studentList.isEmpty()) { + List studentIDs = studentSearchRequest.getStudentIDs(); + if(studentIDs == null || studentIDs.isEmpty()) { + studentIDs = getStudentsForSpecialGradRun(studentSearchRequest, accessToken); + } + if (!studentIDs.isEmpty()) { int partitionSize = 1000; List> partitions = new LinkedList<>(); - for (int i = 0; i < studentList.size(); i += partitionSize) { - partitions.add(studentList.subList(i, Math.min(i + partitionSize, studentList.size()))); + for (int i = 0; i < studentIDs.size(); i += partitionSize) { + partitions.add(studentIDs.subList(i, Math.min(i + partitionSize, studentIDs.size()))); } if (credentialType.equalsIgnoreCase("OC") || credentialType.equalsIgnoreCase("RC")) { processCertificate(partitions, scdList);