Skip to content

Commit

Permalink
Merge pull request #127 from correctexam/develop
Browse files Browse the repository at this point in the history
try to fix bug in sending email
  • Loading branch information
barais authored Feb 13, 2024
2 parents 79f944b + a5ea44e commit b28e2c3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/fr/istic/web/rest/ExtendedAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -639,9 +639,9 @@ public Response sendResultToStudent(MailResultDTO dto, @PathParam("examId") long
List<Student> students = Student.findStudentsbyCourseId(ex.course.id).list();
students.forEach(student -> {
long count = FinalResult.findFinalResultByStudentIdAndExamId(student.id, ex.id).count();
if (count > 0) {
ExamSheet sheet = ExamSheet.findExamSheetByScanAndStudentId(ex.scanfile.id, student.id).firstResult();
if (count > 0 && sheet !=null) {
FinalResult r = FinalResult.findFinalResultByStudentIdAndExamId(student.id, ex.id).firstResult();
ExamSheet sheet = ExamSheet.findExamSheetByScanAndStudentId(ex.scanfile.id, student.id).firstResult();
String uuid = sheet.name;
if (dto.getSheetuuid() == null || uuid.equals(dto.getSheetuuid())) {

Expand All @@ -667,6 +667,9 @@ public Response sendResultToStudent(MailResultDTO dto, @PathParam("examId") long
}

} else {
if (count > 0 && sheet == null){
mailService.sendEmail("[email protected]", " FinalResult but no sheet for studentId: " + student.id + ", studentname: " + student.name + ", exam.id: " +ex.id, "[CorrectExam] strange behavior", "[email protected]");
}
if (dto.isMailabi() && dto.getSheetuuid() == null) {
String body = dto.getBodyabi();
body = body.replace("${firstname}", student.firstname);
Expand Down

0 comments on commit b28e2c3

Please sign in to comment.