From b1e0b937de4bde7a0aa776a40f002106c5109547 Mon Sep 17 00:00:00 2001 From: githubmamatha Date: Wed, 6 Dec 2023 13:01:17 -0800 Subject: [PATCH] Gard2-2341 Part-5 hasDataChanged validation applied correctly to other fields to set flags as Y upon updating them. --- .../service/GraduationStatusService.java | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 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 02f22038..8476f481 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() && !sourceObject.getProgram().equalsIgnoreCase(gradEntity.getProgram())) { + if(hasDataChanged.hasDataChanged()) { deleteStudentOptionalPrograms(sourceObject.getStudentID()); deleteStudentCareerPrograms(sourceObject.getStudentID()); if(gradEntity.getProgram().equalsIgnoreCase("SCCP")) { @@ -220,19 +220,17 @@ public Pair updateGraduationStatus(UUI } else { deleteStudentAchievements(sourceObject.getStudentID(), accessToken); } - } - - if("".equals(sourceObject.getRecalculateGradStatus()) || "N".equalsIgnoreCase(sourceObject.getRecalculateGradStatus())) { - gradEntity.setRecalculateGradStatus(null); - } - else { - gradEntity.setRecalculateGradStatus(sourceObject.getRecalculateGradStatus()); - } - if ("".equals(sourceObject.getRecalculateProjectedGrad()) || "N".equalsIgnoreCase(sourceObject.getRecalculateProjectedGrad())) { - gradEntity.setRecalculateProjectedGrad(null); - } - else { - gradEntity.setRecalculateProjectedGrad(sourceObject.getRecalculateProjectedGrad()); + } else { + if ("".equals(sourceObject.getRecalculateGradStatus()) || "N".equalsIgnoreCase(sourceObject.getRecalculateGradStatus())) { + gradEntity.setRecalculateGradStatus(null); + } else { + gradEntity.setRecalculateGradStatus(sourceObject.getRecalculateGradStatus()); + } + if ("".equals(sourceObject.getRecalculateProjectedGrad()) || "N".equalsIgnoreCase(sourceObject.getRecalculateProjectedGrad())) { + gradEntity.setRecalculateProjectedGrad(null); + } else { + gradEntity.setRecalculateProjectedGrad(sourceObject.getRecalculateProjectedGrad()); + } }