diff --git a/api/src/main/java/ca/bc/gov/educ/api/graduation/service/GraduationService.java b/api/src/main/java/ca/bc/gov/educ/api/graduation/service/GraduationService.java index be133af9..eee950dd 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/graduation/service/GraduationService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/graduation/service/GraduationService.java @@ -384,13 +384,13 @@ private List processStudentList(List gradStudL gradData.setGraduationDate(gsr.getProgramCompletionDate() != null ? EducGraduationApiUtils.parsingTraxDateLocalDate(gsr.getProgramCompletionDate()) : null); gradData.setHonorsFlag(gsr.getHonoursStanding() != null && gsr.getHonoursStanding().equalsIgnoreCase("Y")); std.setGraduationData(gradData); - std.setNonGradReasons(getNonGradReasons(gsr.getNonGradReasons())); + std.setNonGradReasons(getNonGradReasons(gsr.getProgram(), gsr.getNonGradReasons())); stdPrjList.add(std); } else { std.setGraduationData(new ca.bc.gov.educ.api.graduation.model.report.GraduationData()); if (gsr.getStudentProjectedGradData() != null) { ProjectedRunClob projectedClob = (ProjectedRunClob)jsonTransformer.unmarshall(gsr.getStudentProjectedGradData(), ProjectedRunClob.class); - std.setNonGradReasons(getNonGradReasons(projectedClob.getNonGradReasons())); + std.setNonGradReasons(getNonGradReasons(gsr.getProgram(), projectedClob.getNonGradReasons())); if (!projectedClob.isGraduated()) stdPrjList.add(std); } @@ -399,7 +399,8 @@ private List processStudentList(List gradStudL return stdPrjList; } - private List getNonGradReasons(List nonGradReasons) { + private List getNonGradReasons(String gradProgramCode, List nonGradReasons) { + nonGradReasons.removeIf(a -> "506".equalsIgnoreCase(a.getTranscriptRule()) && (StringUtils.isNotBlank(gradProgramCode) && gradProgramCode.contains("1950"))); List nList = new ArrayList<>(); if (nonGradReasons != null) { for (GradRequirement gR : nonGradReasons) { diff --git a/api/src/main/java/ca/bc/gov/educ/api/graduation/service/ReportService.java b/api/src/main/java/ca/bc/gov/educ/api/graduation/service/ReportService.java index e8ac5eed..4fa141e1 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/graduation/service/ReportService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/graduation/service/ReportService.java @@ -278,6 +278,7 @@ private List getNonGradReasons(String gradProgramCode, List applyFilters && "505".equalsIgnoreCase(a.getTranscriptRule()) && (StringUtils.isNotBlank(gradProgramCode) && gradProgramCode.contains("1950"))); + nonGradReasons.removeIf(a -> "506".equalsIgnoreCase(a.getTranscriptRule()) && (StringUtils.isNotBlank(gradProgramCode) && gradProgramCode.contains("1950"))); for (ca.bc.gov.educ.api.graduation.model.dto.GradRequirement gR : nonGradReasons) { String code = xml ? traxReqCodes.get(gR.getRule()) : gR.getTranscriptRule(); NonGradReason obj = new NonGradReason(); @@ -1269,14 +1270,14 @@ private List getOptionalProgramAchvReport(String gradProgramCod op.setHasRequirementMet(" Check with School"); if (existingData != null && existingData.getOptionalRequirementsMet() != null) { op.setHasRequirementMet("The Following Requirements Are Met"); - op.setRequirementMet(getRequirementsMetAchvReport(existingData.getOptionalRequirementsMet(), existingData.getOptionalStudentCourses(), op.getNonGradReasons())); + op.setRequirementMet(getRequirementsMetAchvReport(gradProgramCode, existingData.getOptionalRequirementsMet(), existingData.getOptionalStudentCourses(), op.getNonGradReasons())); } opList.add(op); } return opList; } - private List getRequirementsMetAchvReport(List optionalRequirementsMet, StudentCourses optionalStudentCourses, List nonGradReasons) { + private List getRequirementsMetAchvReport(String gradProgramCode, List optionalRequirementsMet, StudentCourses optionalStudentCourses, List nonGradReasons) { List grList = new ArrayList<>(); for (ca.bc.gov.educ.api.graduation.model.dto.GradRequirement gr : optionalRequirementsMet) { if (!gr.isProjected()) { @@ -1306,6 +1307,7 @@ private List getRequirementsMetAchvReport(List "506".equalsIgnoreCase(a.getCode()) && (StringUtils.isNotBlank(gradProgramCode) && gradProgramCode.contains("1950"))); return grList; } diff --git a/api/src/test/java/ca/bc/gov/educ/api/graduation/service/GraduationServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/graduation/service/GraduationServiceTest.java index 1d475cb4..13c345a0 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/graduation/service/GraduationServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/graduation/service/GraduationServiceTest.java @@ -2030,7 +2030,7 @@ public void testCreateAndStoreSchoolReports() { Mockito.when(gradStatusService.getStudentListByMinCode(mincode, "accessToken")).thenReturn(sList); Mockito.when(schoolService.getSchoolDetails(mincode, "accessToken", exception)).thenReturn(sTrax); int numberOfRecord = graduationService.createAndStoreSchoolReports(uniqueList,"REGALG","accessToken"); - assertEquals(2,numberOfRecord); + assertEquals(1,numberOfRecord); } @Test