Skip to content

Commit

Permalink
Merge pull request #604 from bcgov/feature/GRAD2-2431
Browse files Browse the repository at this point in the history
GRAD2-2431: task is completed.
  • Loading branch information
kamal-mohammed authored Dec 18, 2023
2 parents aca0628 + 72c0f1d commit eab22fb
Showing 1 changed file with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,21 +275,33 @@ private void populateOngoingUpdateFields(List<OngoingUpdateFieldDTO> fields, Gra
if (f.getName() == FieldName.GRAD_PROGRAM) {
String newProgram = (String) f.getValue();
String currentProgram = targetObject.getProgram();
if (!StringUtils.equalsIgnoreCase(currentProgram, newProgram)) {
if("SCCP".equalsIgnoreCase(currentProgram)) {
log.info(" {} ==> {}: Archive Student Achievements and SLP_DATE is set to null.", currentProgram, newProgram);
targetObject.setProgramCompletionDate(null);
graduationStatusService.archiveStudentAchievements(targetObject.getStudentID(),accessToken);
} else {
log.info(" {} ==> {}: Delete Student Achievements.", currentProgram, newProgram);
graduationStatusService.deleteStudentAchievements(targetObject.getStudentID(), accessToken);
}
}
handleStudentAchievements(currentProgram, newProgram, targetObject, accessToken);
resetAdultStartDate(currentProgram, newProgram, targetObject);
}
populate(f, targetObject);
});
}

private void handleStudentAchievements(String currentProgram, String newProgram, GraduationStudentRecordEntity targetObject, String accessToken) {
if (!StringUtils.equalsIgnoreCase(currentProgram, newProgram)) {
if("SCCP".equalsIgnoreCase(currentProgram)) {
log.info(" {} ==> {}: Archive Student Achievements and SLP_DATE is set to null.", currentProgram, newProgram);
targetObject.setProgramCompletionDate(null);
graduationStatusService.archiveStudentAchievements(targetObject.getStudentID(),accessToken);
} else {
log.info(" {} ==> {}: Delete Student Achievements.", currentProgram, newProgram);
graduationStatusService.deleteStudentAchievements(targetObject.getStudentID(), accessToken);
}
}
}

private void resetAdultStartDate(String currentProgram, String newProgram, GraduationStudentRecordEntity targetObject) {
// Only when 1950 adult program is channged to another, reset adultStartDate to null
if (!StringUtils.equalsIgnoreCase(currentProgram, newProgram) && "1950".equalsIgnoreCase(currentProgram)) {
targetObject.setAdultStartDate(null);
}
}

private void populate(OngoingUpdateFieldDTO field, GraduationStudentRecordEntity targetObject) {
switch (field.getName()) {
case SCHOOL_OF_RECORD -> {
Expand Down

0 comments on commit eab22fb

Please sign in to comment.