Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRAD2-2412: concurrency issue is fixed to use the right grad program … #602

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ public GraduationStudentRecord updateGraduationStatusByFields(OngoingUpdateReque
@Retry(name = "generalpostcall")
public StudentOptionalProgram saveStudentOptionalProgram(StudentOptionalProgramRequestDTO studentOptionalProgramReq, String accessToken) {
if (studentOptionalProgramReq.getOptionalProgramID() == null) {
Optional<GraduationStudentRecordEntity> gradStatusOptional = graduationStatusRepository.findById(studentOptionalProgramReq.getStudentID());
if (gradStatusOptional.isPresent()) {
String currentGradProgramCode = gradStatusOptional.get().getProgram();
// GRAD2-2412: concurrency issue as grad program might be changed by another event by a millisecond.
// => if the requested grad program is different from the current grad program, then use the existing one.
if (!StringUtils.equalsIgnoreCase(studentOptionalProgramReq.getMainProgramCode(), currentGradProgramCode)) {
studentOptionalProgramReq.setMainProgramCode(currentGradProgramCode);
}
}
OptionalProgram gradOptionalProgram = getOptionalProgram(studentOptionalProgramReq.getMainProgramCode(), studentOptionalProgramReq.getOptionalProgramCode(), accessToken);
if (gradOptionalProgram == null) {
return null;
Expand Down
Loading