diff --git a/api/src/main/java/ca/bc/gov/educ/api/dataconversion/model/StudentCommonDTO.java b/api/src/main/java/ca/bc/gov/educ/api/dataconversion/model/StudentCommonDTO.java index 54d038ea..ce236428 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/dataconversion/model/StudentCommonDTO.java +++ b/api/src/main/java/ca/bc/gov/educ/api/dataconversion/model/StudentCommonDTO.java @@ -40,4 +40,8 @@ public boolean isGraduated() { public boolean isSCCP() { return "SCCP".equalsIgnoreCase(program); } + + public boolean isArchived() { + return "ARC".equalsIgnoreCase(studentStatus); + } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/dataconversion/service/student/StudentBaseService.java b/api/src/main/java/ca/bc/gov/educ/api/dataconversion/service/student/StudentBaseService.java index db95cc31..d2ce815c 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/dataconversion/service/student/StudentBaseService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/dataconversion/service/student/StudentBaseService.java @@ -128,7 +128,7 @@ protected String getGradProgramForGraduatedStudent(String graduationRequirementY } protected void populateNewBatchFlags(StudentGradDTO currentStudent) { - if ("ARC".equalsIgnoreCase(currentStudent.getStudentStatus())) { + if (STUDENT_STATUS_ARCHIVED.equalsIgnoreCase(currentStudent.getStudentStatus())) { // Transcript currentStudent.setNewRecalculateGradStatus("Y"); } else { diff --git a/api/src/main/java/ca/bc/gov/educ/api/dataconversion/service/student/StudentGraduationUpdateEventService.java b/api/src/main/java/ca/bc/gov/educ/api/dataconversion/service/student/StudentGraduationUpdateEventService.java index 27d4b34f..c4ecf128 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/dataconversion/service/student/StudentGraduationUpdateEventService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/dataconversion/service/student/StudentGraduationUpdateEventService.java @@ -73,17 +73,19 @@ public void processStudent(TraxGraduationUpdateDTO updateGrad, StudentGradDTO cu boolean isChanged = false; log.info(" Process Student : studentID = {}, pen = {}", currentStudent.getStudentID(), updateGrad.getPen()); - if ("ARC".equalsIgnoreCase(currentStudent.getStudentStatus())) { + if (currentStudent.isArchived() && currentStudent.isGraduated()) { return; } // Order is important for first 3 items below!!! // 1. School of record if (!StringUtils.equals(updateGrad.getSchoolOfRecord(), currentStudent.getSchoolOfRecord())) { currentStudent.setNewSchoolOfRecord(updateGrad.getSchoolOfRecord()); - // Transcript - currentStudent.setNewRecalculateGradStatus("Y"); - // TVR - currentStudent.setNewRecalculateProjectedGrad("Y"); + if (!currentStudent.isArchived()) { + // Transcript + currentStudent.setNewRecalculateGradStatus("Y"); + // TVR + currentStudent.setNewRecalculateProjectedGrad("Y"); + } log.info(" => school of record : current = {}, request = {}", currentStudent.getSchoolOfRecord(), currentStudent.getNewSchoolOfRecord()); isChanged = true; } @@ -92,10 +94,12 @@ public void processStudent(TraxGraduationUpdateDTO updateGrad, StudentGradDTO cu if (!StringUtils.equals(gradProgram, currentStudent.getProgram())) { handleProgramChange(gradProgram, currentStudent, updateGrad.getPen(), accessToken); handleAdultStartDate(currentStudent); - // Transcript - currentStudent.setNewRecalculateGradStatus("Y"); - // TVR - currentStudent.setNewRecalculateProjectedGrad("Y"); + if (!currentStudent.isArchived()) { + // Transcript + currentStudent.setNewRecalculateGradStatus("Y"); + // TVR + currentStudent.setNewRecalculateProjectedGrad("Y"); + } log.info(" => grad program : current = {}, request = {}", currentStudent.getProgram(), currentStudent.getNewProgram()); isChanged = true; } @@ -104,24 +108,28 @@ public void processStudent(TraxGraduationUpdateDTO updateGrad, StudentGradDTO cu if (slpDate != null && "SCCP".equalsIgnoreCase(currentStudent.getUpToDateGradProgram()) && !StringUtils.equals(slpDate, currentStudent.getGradDate())) { currentStudent.setNewGradDate(slpDate); - // Transcript - currentStudent.setNewRecalculateGradStatus("Y"); - // TVR - currentStudent.setNewRecalculateProjectedGrad("Y"); + if (!currentStudent.isArchived()) { + // Transcript + currentStudent.setNewRecalculateGradStatus("Y"); + // TVR + currentStudent.setNewRecalculateProjectedGrad("Y"); + } log.info(" => student slp date : current = {}, request = {}", currentStudent.getGradDate(), slpDate); isChanged = true; } // Student Grade if (!StringUtils.equals(updateGrad.getStudentGrade(), currentStudent.getStudentGrade())) { currentStudent.setNewStudentGrade(updateGrad.getStudentGrade()); - if (!currentStudent.isGraduated() ) { // non grad - // Transcript - currentStudent.setNewRecalculateGradStatus("Y"); - // TVR - currentStudent.setNewRecalculateProjectedGrad("Y"); - } else { - // TVR - currentStudent.setNewRecalculateProjectedGrad("Y"); + if (!currentStudent.isArchived()) { + if (!currentStudent.isGraduated()) { // non grad + // Transcript + currentStudent.setNewRecalculateGradStatus("Y"); + // TVR + currentStudent.setNewRecalculateProjectedGrad("Y"); + } else { + // TVR + currentStudent.setNewRecalculateProjectedGrad("Y"); + } } log.info(" => student grade : current = {}, request = {}", currentStudent.getStudentGrade(), currentStudent.getNewStudentGrade()); isChanged = true; @@ -129,14 +137,16 @@ public void processStudent(TraxGraduationUpdateDTO updateGrad, StudentGradDTO cu // Citizenship if (!StringUtils.equals(updateGrad.getCitizenship(), currentStudent.getCitizenship())) { currentStudent.setNewCitizenship(updateGrad.getCitizenship()); - if (!currentStudent.isGraduated() ) { // non grad - // Transcript - currentStudent.setNewRecalculateGradStatus("Y"); - // TVR - currentStudent.setNewRecalculateProjectedGrad("Y"); - } else { - // TVR - currentStudent.setNewRecalculateProjectedGrad("Y"); + if (!currentStudent.isArchived()) { + if (!currentStudent.isGraduated()) { // non grad + // Transcript + currentStudent.setNewRecalculateGradStatus("Y"); + // TVR + currentStudent.setNewRecalculateProjectedGrad("Y"); + } else { + // TVR + currentStudent.setNewRecalculateProjectedGrad("Y"); + } } log.info(" => student citizenship : current = {}, request = {}", currentStudent.getCitizenship(), currentStudent.getNewCitizenship()); isChanged = true; diff --git a/api/src/main/java/ca/bc/gov/educ/api/dataconversion/service/student/StudentStatusUpdateEventService.java b/api/src/main/java/ca/bc/gov/educ/api/dataconversion/service/student/StudentStatusUpdateEventService.java index 8d2eba12..51f52e8b 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/dataconversion/service/student/StudentStatusUpdateEventService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/dataconversion/service/student/StudentStatusUpdateEventService.java @@ -76,9 +76,9 @@ public void processStudent(TraxStudentStatusUpdateDTO studentStatusUpdate, Stude // Student Status if (!StringUtils.equals(newStudentStatus, currentStudent.getStudentStatus())) { currentStudent.setNewStudentStatus(newStudentStatus); - if (StringUtils.equalsIgnoreCase(currentStudent.getNewStudentStatus(), "CUR") - || StringUtils.equalsIgnoreCase(currentStudent.getNewStudentStatus(), "TER") - || StringUtils.equalsIgnoreCase(currentStudent.getNewStudentStatus(), "DEC")) { + if (StringUtils.equalsIgnoreCase(currentStudent.getNewStudentStatus(), STUDENT_STATUS_CURRENT) + || StringUtils.equalsIgnoreCase(currentStudent.getNewStudentStatus(), STUDENT_STATUS_TERMINATED) + || StringUtils.equalsIgnoreCase(currentStudent.getNewStudentStatus(), STUDENT_STATUS_DECEASED)) { // Transcript currentStudent.setNewRecalculateGradStatus("Y"); // TVR