From a6e0d6298df1cc9f8c209d406792bfa71eb865c3 Mon Sep 17 00:00:00 2001 From: arybakov Date: Tue, 14 May 2024 13:00:24 -0600 Subject: [PATCH] GRAD2-2580 (GRAD) Fix User Request Distribution Run options - Part 2 - CUR and Null Distribution Dates --- .../educ/api/grad/report/controller/CommonController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/ca/bc/gov/educ/api/grad/report/controller/CommonController.java b/api/src/main/java/ca/bc/gov/educ/api/grad/report/controller/CommonController.java index 851a24ac..ed676e89 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/grad/report/controller/CommonController.java +++ b/api/src/main/java/ca/bc/gov/educ/api/grad/report/controller/CommonController.java @@ -19,7 +19,6 @@ import org.springframework.web.bind.annotation.*; import java.util.List; -import java.util.Objects; import java.util.UUID; @CrossOrigin @@ -278,7 +277,10 @@ public ResponseEntity> getStudentCredentials @PathVariable String credentialType, @RequestBody StudentSearchRequest studentSearchRequest, @RequestHeader(name="Authorization") String accessToken) { logger.debug("getStudentCredentialsForUserRequestDisRun : "); - return response.GET(commonService.getStudentCredentialsForUserRequestDisRun(credentialType,studentSearchRequest,false,accessToken.replace(BEARER, ""))); + boolean isPenNumberSearch = studentSearchRequest.getPens() != null && !studentSearchRequest.getPens().isEmpty() + && !studentSearchRequest.getPens().stream().filter(StringUtils::isNotBlank).toList().isEmpty(); + boolean onlyWithNullDistributionDate = !isPenNumberSearch && studentSearchRequest.getGradDateFrom() == null && studentSearchRequest.getGradDateTo() == null; + return response.GET(commonService.getStudentCredentialsForUserRequestDisRun(credentialType,studentSearchRequest,onlyWithNullDistributionDate,accessToken.replace(BEARER, ""))); } @PostMapping(EducGradReportApiConstants.USER_REQUEST_DIS_RUN_WITH_NULL_DISTRIBUTION_DATE)