From 23fb43f2d90373b5859a7bdf27f677d0232ed7e0 Mon Sep 17 00:00:00 2001 From: githubmamatha Date: Wed, 6 Dec 2023 16:04:49 -0800 Subject: [PATCH 1/2] Gard2-2341 Part-7 set the flags as Y when program is changed. --- .../api/gradstudent/service/GraduationStatusService.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 4e453efc..8711b34e 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 @@ -205,7 +205,7 @@ public Pair updateGraduationStatus(UUI validation.stopOnErrors(); return Pair.of(new GraduationStudentRecord(), null); } - if(hasDataChanged.hasDataChanged()) { + if(hasDataChanged.hasDataChanged() && !sourceObject.getProgram().equalsIgnoreCase(gradEntity.getProgram())) { deleteStudentOptionalPrograms(sourceObject.getStudentID()); deleteStudentCareerPrograms(sourceObject.getStudentID()); if(gradEntity.getProgram().equalsIgnoreCase("SCCP")) { @@ -222,6 +222,11 @@ public Pair updateGraduationStatus(UUI } } + if (hasDataChanged.hasDataChanged()) { + gradEntity.setRecalculateGradStatus(hasDataChanged.getRecalculateGradStatus()); + gradEntity.setRecalculateProjectedGrad(hasDataChanged.getRecalculateProgectedGrad()); + } + BeanUtils.copyProperties(sourceObject, gradEntity, CREATE_USER, CREATE_DATE, "studentGradData", "studentProjectedGradData", "recalculateGradStatus", "recalculateProjectedGrad"); gradEntity.setProgramCompletionDate(sourceObject.getProgramCompletionDate()); gradEntity.setUpdateUser(null); From 9aab59965d14b92d89316dcbad0058629224c44a Mon Sep 17 00:00:00 2001 From: githubmamatha Date: Thu, 7 Dec 2023 08:02:59 -0800 Subject: [PATCH 2/2] Gard2-2341 Part-7a code clean up --- .../api/gradstudent/service/GraduationStatusService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 8711b34e..f5685851 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 @@ -227,9 +227,6 @@ public Pair updateGraduationStatus(UUI gradEntity.setRecalculateProjectedGrad(hasDataChanged.getRecalculateProgectedGrad()); } - BeanUtils.copyProperties(sourceObject, gradEntity, CREATE_USER, CREATE_DATE, "studentGradData", "studentProjectedGradData", "recalculateGradStatus", "recalculateProjectedGrad"); - gradEntity.setProgramCompletionDate(sourceObject.getProgramCompletionDate()); - gradEntity.setUpdateUser(null); if(!hasDataChanged.hasDataChanged()) { if ("".equals(sourceObject.getRecalculateGradStatus()) || "N".equalsIgnoreCase(sourceObject.getRecalculateGradStatus())) { gradEntity.setRecalculateGradStatus(null); @@ -242,6 +239,10 @@ public Pair updateGraduationStatus(UUI gradEntity.setRecalculateProjectedGrad(sourceObject.getRecalculateProjectedGrad()); } } + + BeanUtils.copyProperties(sourceObject, gradEntity, CREATE_USER, CREATE_DATE, "studentGradData", "studentProjectedGradData", "recalculateGradStatus", "recalculateProjectedGrad"); + gradEntity.setProgramCompletionDate(sourceObject.getProgramCompletionDate()); + gradEntity.setUpdateUser(null); gradEntity = graduationStatusRepository.saveAndFlush(gradEntity); historyService.createStudentHistory(gradEntity, USER_EDIT); final GradStatusEvent gradStatusEvent = createGradStatusEvent(gradEntity.getUpdateUser(), gradEntity,