Skip to content

Commit

Permalink
GRAD2-2464
Browse files Browse the repository at this point in the history
Backend changes for Optional Program CRUD
  • Loading branch information
arybakov-cgi committed Jan 31, 2024
1 parent 3eebf76 commit 649e375
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -801,10 +801,13 @@ public StudentOptionalProgram createStudentGradOptionalProgram(UUID studentID, S
gradEnity.setOptionalProgramCompletionDate(sourceObject.getOptionalProgramCompletionDate());
StudentOptionalProgramEntity gradEnitySaved = gradStudentOptionalProgramRepository.save(gradEnity);
if(StringUtils.equalsIgnoreCase(careerProgramCode, "CP")) {
StudentCareerProgramEntity studentCareerProgramEntity = new StudentCareerProgramEntity();
studentCareerProgramEntity.setStudentID(studentID);
studentCareerProgramEntity.setCareerProgramCode(careerProgramCode);
gradStudentCareerProgramRepository.save(studentCareerProgramEntity);
Optional<StudentCareerProgramEntity> optionalStudentCareerProgramEntity = gradStudentCareerProgramRepository.findByStudentIDAndCareerProgramCode(studentID, careerProgramCode);
if(!optionalStudentCareerProgramEntity.isPresent()) {
StudentCareerProgramEntity studentCareerProgramEntity = new StudentCareerProgramEntity();
studentCareerProgramEntity.setStudentID(studentID);
studentCareerProgramEntity.setCareerProgramCode(careerProgramCode);
gradStudentCareerProgramRepository.save(studentCareerProgramEntity);
}
}
historyService.createStudentOptionalProgramHistory(gradEnitySaved, USER_CREATE);
graduationStatusRepository.updateGradStudentRecalculationFlags(studentID, "Y", "Y");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,7 @@ public void testCreateCRUDStudentGradOptionalProgram() {
Optional<GraduationStudentRecordEntity> optionalGraduationStudentRecordEntity = Optional.of(graduationStudentRecordEntity);

when(graduationStatusRepository.findById(studentID)).thenReturn(optionalGraduationStudentRecordEntity);
when(gradStudentCareerProgramRepository.findByStudentIDAndCareerProgramCode(studentID, "CP")).thenReturn(Optional.empty());
when(gradStudentOptionalProgramRepository.save(gradStudentOptionalProgramEntity)).thenReturn(gradStudentOptionalProgramEntity);
doNothing().when(historyService).createStudentOptionalProgramHistory(gradStudentOptionalProgramEntity, "USER_CREATE");
doNothing().when(graduationStatusRepository).updateGradStudentRecalculationFlags(studentID, "Y", "Y");
Expand Down

0 comments on commit 649e375

Please sign in to comment.