Unverified Commit 9209e044 authored by Ankit Verma's avatar Ankit Verma Committed by GitHub
Browse files

Merge pull request #188 from Radheshhathwar/development

Showing with 12 additions and 10 deletions
+12 -10
......@@ -58,7 +58,7 @@ public interface StudentExamRegistrationRepository extends JpaRepository<Student
@Query("SELECT s FROM Student s WHERE s.verificationStatus = com.tarento.upsmf.examsAndAdmissions.enums.VerificationStatus.VERIFIED AND s.institute.id = :instituteId AND NOT EXISTS (SELECT ser FROM StudentExamRegistration ser WHERE ser.student.id = s.id AND ser.examCycle.id = :examCycleId)")
List<Student> findVerifiedStudentsNotRegisteredForExamCycleByInstitute(Long examCycleId, Long instituteId);
StudentExamRegistration getByStudentId(Long id);
List<StudentExamRegistration> getByStudentId(Long id);
StudentExamRegistration getByStudentIdAndExamCycleId(Long studentId, Long examCycleId);
......
......@@ -354,22 +354,22 @@ public class HallTicketService {
formattedRequest.put("prevDob", student.getDateOfBirth());
formattedRequest.put("enrollmentNumber", student.getEnrollmentNumber());
if (Objects.equals(request.getUpdatedFirstName(), student.getFirstName())){
formattedRequest.put("firstNameFlag",TRUE);
formattedRequest.put("firstNameFlag",FALSE);
}
else {
formattedRequest.put("firstNameFlag",FALSE);
formattedRequest.put("firstNameFlag",TRUE);
}
if (Objects.equals(request.getUpdatedLastName(), student.getSurname())){
formattedRequest.put("lastNameFlag",TRUE);
formattedRequest.put("lastNameFlag",FALSE);
}
else {
formattedRequest.put("lastNameFlag",FALSE);
formattedRequest.put("lastNameFlag",TRUE);
}
if (request.getUpdatedDOB() == student.getDateOfBirth()){
formattedRequest.put("dobFlag",TRUE);
formattedRequest.put("dobFlag",FALSE);
}
else {
formattedRequest.put("dobFlag",FALSE);
formattedRequest.put("dobFlag",TRUE);
}
List<StudentExamRegistration> registration = studentExamRegistrationRepository.getByExamCycleIdAndStudentId(request.getExamCycle().getId(), request.getStudent().getId());
......@@ -440,9 +440,11 @@ public class HallTicketService {
studentRepository.save(student);
// 2. Regenerate the hall ticket with the updated details
Optional<StudentExamRegistration> registrationOptional = Optional.ofNullable(studentExamRegistrationRepository.findByStudent(student));
if (registrationOptional.isPresent()) {
StudentExamRegistration registration = registrationOptional.get();
// Optional<StudentExamRegistration> registrationOptional = Optional.ofNullable(studentExamRegistrationRepository.findByStudent(student));
List<StudentExamRegistration> registrationOptional = studentExamRegistrationRepository.getByStudentId(student.getId());
if (!registrationOptional.isEmpty()) {
StudentExamRegistration registration = registrationOptional.get(0);
byte[] hallTicketData = generateHallTicket(registration);
if (hallTicketData.length > 0) {
MultipartFile hallTicket = new ByteArrayMultipartFile(hallTicketData, "hallticket_updated_" + student.getId() + ".pdf");
......
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