Commit d8bf4efe authored by Radheshhathwar's avatar Radheshhathwar
Browse files

Changes for assign alternative examCenter

1 merge request!191Changes for assign alternative examCenter
Showing with 13 additions and 2 deletions
+13 -2
package com.tarento.upsmf.examsAndAdmissions.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.tarento.upsmf.examsAndAdmissions.enums.ApprovalStatus;
import lombok.*;
......@@ -43,6 +44,16 @@ public class ExamCenter {
private Boolean alternateExamCenterAssigned = false;
@OneToOne
@JoinColumn(name = "alternate_exam_center_id")
// @JsonIgnore // Ignore this field during JSON serialization
private ExamCenter alternateExamCenter;
@Override
public String toString() {
return "ExamCenter{" +
"id=" + id +
", name='" + name + '\'' +
// ... (other fields)
", alternateExamCenter=" + (alternateExamCenter != null ? alternateExamCenter.getId() : null) + // Handle alternateExamCenter to break the cyclic reference
'}';
}
}
......@@ -78,13 +78,13 @@ public class ExamCenterService {
// Set the alternate exam center for the unverified exam center
unverifiedExamCenter.setAlternateExamCenter(alternateExamCenter);
unverifiedExamCenter.setAlternateExamCenterAssigned(true);
examCenterRepository.save(unverifiedExamCenter);
unverifiedExamCenter = examCenterRepository.save(unverifiedExamCenter);
// Save the updated registrations
List<StudentExamRegistration> updatedRegistrations = studentExamRegistrationRepository.saveAll(affectedRegistrations);
response.put("message", "Alternate Exam Center assigned successfully.");
response.put(Constants.RESPONSE, updatedRegistrations);
response.put(Constants.RESPONSE, unverifiedExamCenter);
response.setResponseCode(HttpStatus.OK);
}
} catch (EntityNotFoundException e) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment