From 5f087f61b81a0b60ae386be69abd2d01751776c2 Mon Sep 17 00:00:00 2001 From: mightycox Date: Wed, 4 Dec 2024 14:49:43 -0800 Subject: [PATCH] GRAD2-3102 - clears schoolAtGradId when schoolAtGrad is cleared --- .../educ/api/gradstudent/service/GraduationStatusService.java | 3 +++ .../api/gradstudent/service/GraduationStatusServiceTest.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusService.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusService.java index a2e6a765..2e9a3f92 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusService.java +++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusService.java @@ -246,6 +246,7 @@ public Pair updateGraduationStatus(UUI sourceObject.setHonoursStanding(null); sourceObject.setGpa(null); sourceObject.setSchoolAtGrad(null); + sourceObject.setSchoolAtGradId(null); archiveStudentAchievements(sourceObject.getStudentID(),accessToken); } else { deleteStudentAchievements(sourceObject.getStudentID(), accessToken); @@ -1101,6 +1102,7 @@ public Pair undoCompletionStudent(UUID gradEntity.setHonoursStanding(null); gradEntity.setGpa(null); gradEntity.setSchoolAtGrad(null); + gradEntity.setSchoolAtGradId(null); gradEntity.setUpdateUser(null); gradEntity = graduationStatusRepository.save(gradEntity); historyService.createStudentHistory(gradEntity, USER_UNDO_CMPL); @@ -1213,6 +1215,7 @@ public boolean restoreGradStudentRecord(UUID studentID,boolean isGraduated) { gradEnity.setHonoursStanding(null); gradEnity.setGpa(null); gradEnity.setSchoolAtGrad(null); + gradEnity.setSchoolAtGradId(null); } graduationStatusRepository.save(gradEnity); return true; diff --git a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusServiceTest.java index 7b27b911..568ae40e 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/gradstudent/service/GraduationStatusServiceTest.java @@ -728,6 +728,7 @@ public void testUpdateGraduationStatus_givenDifferentPrograms_when1950ProgramIsV assertThat(result.getStudentStatus()).isNull(); assertThat(result.getProgram()).isNull(); assertThat(result.getSchoolOfRecord()).isNull(); + assertThat(result.getSchoolAtGradId()).isNull(); assertThat(result.getGpa()).isNull(); assertThat(result.getRecalculateGradStatus()).isNull(); @@ -788,6 +789,7 @@ public void testUpdateGraduationStatus_givenDifferentPrograms_whenProgramIsValid assertThat(result.getStudentStatus()).isNull(); assertThat(result.getProgram()).isNull(); assertThat(result.getSchoolOfRecord()).isNull(); + assertThat(result.getSchoolAtGradId()).isNull(); assertThat(result.getGpa()).isNull(); assertThat(result.getRecalculateGradStatus()).isNull(); @@ -2039,6 +2041,7 @@ public void testUgradStudent() throws JsonProcessingException { assertThat(result.getHonoursStanding()).isNull(); assertThat(result.getGpa()).isNull(); assertThat(result.getSchoolAtGrad()).isNull(); + assertThat(result.getSchoolAtGradId()).isNull(); } @Test