diff --git a/src/main/java/com/graduationproject/studentinformationsystem/university/note/controller/StudentLessonNoteController.java b/src/main/java/com/graduationproject/studentinformationsystem/university/note/controller/StudentLessonNoteController.java index 8cca0cf2..3513330f 100644 --- a/src/main/java/com/graduationproject/studentinformationsystem/university/note/controller/StudentLessonNoteController.java +++ b/src/main/java/com/graduationproject/studentinformationsystem/university/note/controller/StudentLessonNoteController.java @@ -3,9 +3,9 @@ import com.graduationproject.studentinformationsystem.common.util.controller.response.SisBaseApiResponse; import com.graduationproject.studentinformationsystem.common.util.exception.SisNotExistException; import com.graduationproject.studentinformationsystem.university.note.controller.endpoint.StudentLessonNoteControllerEndpoint; -import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentLessonFinalNoteUpdateRequest; -import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentLessonMidtermNoteUpdateRequest; -import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentLessonResitNoteUpdateRequest; +import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentsLessonFinalNotesUpdateRequest; +import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentsLessonMidtermNotesUpdateRequest; +import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentsLessonResitNotesUpdateRequest; import com.graduationproject.studentinformationsystem.university.note.model.dto.response.StudentLessonNoteResponse; import com.graduationproject.studentinformationsystem.university.note.service.StudentLessonNoteService; import io.swagger.annotations.Api; @@ -52,31 +52,31 @@ public ResponseEntity>> getAl @PutMapping(StudentLessonNoteControllerEndpoint.MIDTERM) @ApiOperation(value = "Update Student Lesson Midterm Note") - public ResponseEntity> updateStudentLessonMidtermNote( - @RequestBody @Valid final StudentLessonMidtermNoteUpdateRequest updateRequest) + public ResponseEntity>> updateStudentsLessonMidtermNotes( + @RequestBody @Valid final StudentsLessonMidtermNotesUpdateRequest updateRequest) throws SisNotExistException { - final StudentLessonNoteResponse noteResponse = studentLessonNoteService.updateStudentLessonMidtermNote(updateRequest); - return successResponse(noteResponse); + final List noteResponses = studentLessonNoteService.updateStudentsLessonMidtermNotes(updateRequest); + return successResponse(noteResponses); } @PutMapping(StudentLessonNoteControllerEndpoint.FINAL) @ApiOperation(value = "Update Student Lesson Final Note") - public ResponseEntity> updateStudentLessonFinalNote( - @RequestBody @Valid final StudentLessonFinalNoteUpdateRequest updateRequest) + public ResponseEntity>> updateStudentsLessonFinalNotes( + @RequestBody @Valid final StudentsLessonFinalNotesUpdateRequest updateRequest) throws SisNotExistException { - final StudentLessonNoteResponse noteResponse = studentLessonNoteService.updateStudentLessonFinalNote(updateRequest); - return successResponse(noteResponse); + final List noteResponses = studentLessonNoteService.updateStudentsLessonFinalNotes(updateRequest); + return successResponse(noteResponses); } @PutMapping(StudentLessonNoteControllerEndpoint.RESIT) @ApiOperation(value = "Update Student Lesson Resit Note") - public ResponseEntity> updateStudentLessonResitNote( - @RequestBody final StudentLessonResitNoteUpdateRequest updateRequest) + public ResponseEntity>> updateStudentsLessonResitNotes( + @RequestBody final StudentsLessonResitNotesUpdateRequest updateRequest) throws SisNotExistException { - final StudentLessonNoteResponse noteResponse = studentLessonNoteService.updateStudentLessonResitNote(updateRequest); - return successResponse(noteResponse); + final List noteResponses = studentLessonNoteService.updateStudentsLessonResitNotes(updateRequest); + return successResponse(noteResponses); } } diff --git a/src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/converter/StudentLessonNoteInfoConverter.java b/src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/converter/StudentLessonNoteInfoConverter.java index 8044da08..a9621255 100644 --- a/src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/converter/StudentLessonNoteInfoConverter.java +++ b/src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/converter/StudentLessonNoteInfoConverter.java @@ -4,10 +4,7 @@ import com.graduationproject.studentinformationsystem.common.util.SisUtil; import com.graduationproject.studentinformationsystem.university.lesson.common.model.dto.response.LessonResponse; import com.graduationproject.studentinformationsystem.university.lesson.common.service.LessonOutService; -import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentLessonFinalNoteUpdateRequest; -import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentLessonMidtermNoteUpdateRequest; import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentLessonNoteSaveRequest; -import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentLessonResitNoteUpdateRequest; import com.graduationproject.studentinformationsystem.university.note.model.dto.response.StudentLessonNoteResponse; import com.graduationproject.studentinformationsystem.university.note.model.entity.*; import com.graduationproject.studentinformationsystem.university.note.model.enums.StudentLessonNoteStatus; @@ -46,27 +43,27 @@ public StudentLessonNoteSaveEntity generateSaveEntity(final StudentLessonNoteSav .build(); } - public StudentLessonMidtermNoteUpdateEntity generateMidtermNoteUpdateEntity(final StudentLessonMidtermNoteUpdateRequest updateRequest) { - - final SisOperationInfoRequest operationInfoRequest = updateRequest.getOperationInfoRequest(); + public StudentLessonMidtermNoteUpdateEntity generateMidtermNoteUpdateEntity(final String lessonNoteId, + final Double midtermNote, + final SisOperationInfoRequest operationInfoRequest) { return StudentLessonMidtermNoteUpdateEntity.builder() - .id(updateRequest.getId()) - .midtermNote(updateRequest.getMidtermNote()) + .id(lessonNoteId) + .midtermNote(midtermNote) .modifiedUserId(operationInfoRequest.getUserId()) .modifiedDate(new Date()) .build(); } - public StudentLessonFinalNoteUpdateEntity generateFinalNoteUpdateEntity(final Double meanOfNote, + public StudentLessonFinalNoteUpdateEntity generateFinalNoteUpdateEntity(final String lessonNoteId, + final Double finalNote, + final Double meanOfNote, final StudentLessonNoteStatus status, - final StudentLessonFinalNoteUpdateRequest updateRequest) { - - final SisOperationInfoRequest operationInfoRequest = updateRequest.getOperationInfoRequest(); + final SisOperationInfoRequest operationInfoRequest) { return StudentLessonFinalNoteUpdateEntity.builder() - .id(updateRequest.getId()) - .finalNote(updateRequest.getFinalNote()) + .id(lessonNoteId) + .finalNote(finalNote) .meanOfNote(meanOfNote) .status(status) .modifiedUserId(operationInfoRequest.getUserId()) @@ -74,15 +71,15 @@ public StudentLessonFinalNoteUpdateEntity generateFinalNoteUpdateEntity(final Do .build(); } - public StudentLessonResitNoteUpdateEntity generateResitNoteUpdateEntity(final Double meanOfNote, + public StudentLessonResitNoteUpdateEntity generateResitNoteUpdateEntity(final String lessonNoteId, + final Double finalNote, + final Double meanOfNote, final StudentLessonNoteStatus status, - final StudentLessonResitNoteUpdateRequest updateRequest) { - - final SisOperationInfoRequest operationInfoRequest = updateRequest.getOperationInfoRequest(); + final SisOperationInfoRequest operationInfoRequest) { return StudentLessonResitNoteUpdateEntity.builder() - .id(updateRequest.getId()) - .resitNote(updateRequest.getResitNote()) + .id(lessonNoteId) + .resitNote(finalNote) .meanOfNote(meanOfNote) .status(status) .modifiedUserId(operationInfoRequest.getUserId()) diff --git a/src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentLessonMidtermNoteUpdateRequest.java b/src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentsLessonFinalNotesUpdateRequest.java similarity index 65% rename from src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentLessonMidtermNoteUpdateRequest.java rename to src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentsLessonFinalNotesUpdateRequest.java index 7fbcb329..9ec6b786 100644 --- a/src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentLessonMidtermNoteUpdateRequest.java +++ b/src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentsLessonFinalNotesUpdateRequest.java @@ -6,23 +6,21 @@ import lombok.experimental.SuperBuilder; import javax.validation.Valid; -import javax.validation.constraints.NotNull; +import javax.validation.constraints.NotEmpty; import java.io.Serial; import java.io.Serializable; +import java.util.Map; @Getter @SuperBuilder @NoArgsConstructor -public class StudentLessonMidtermNoteUpdateRequest implements Serializable { +public class StudentsLessonFinalNotesUpdateRequest implements Serializable { @Serial - private static final long serialVersionUID = 7596735869510130790L; + private static final long serialVersionUID = 5093920385984058988L; - @NotNull - private String id; - - @NotNull - private Double midtermNote; + @NotEmpty + private Map finalNoteIdsAndNotes; @Valid private SisOperationInfoRequest operationInfoRequest; diff --git a/src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentLessonResitNoteUpdateRequest.java b/src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentsLessonMidtermNotesUpdateRequest.java similarity index 63% rename from src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentLessonResitNoteUpdateRequest.java rename to src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentsLessonMidtermNotesUpdateRequest.java index 8da009f1..b29c5bc1 100644 --- a/src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentLessonResitNoteUpdateRequest.java +++ b/src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentsLessonMidtermNotesUpdateRequest.java @@ -6,23 +6,21 @@ import lombok.experimental.SuperBuilder; import javax.validation.Valid; -import javax.validation.constraints.NotNull; +import javax.validation.constraints.NotEmpty; import java.io.Serial; import java.io.Serializable; +import java.util.Map; @Getter @SuperBuilder @NoArgsConstructor -public class StudentLessonResitNoteUpdateRequest implements Serializable { +public class StudentsLessonMidtermNotesUpdateRequest implements Serializable { @Serial - private static final long serialVersionUID = -6303107915064579379L; + private static final long serialVersionUID = 5142587290257640755L; - @NotNull - private String id; - - @NotNull - private Double resitNote; + @NotEmpty + private Map midtermNoteIdsAndNotes; @Valid private SisOperationInfoRequest operationInfoRequest; diff --git a/src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentLessonFinalNoteUpdateRequest.java b/src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentsLessonResitNotesUpdateRequest.java similarity index 63% rename from src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentLessonFinalNoteUpdateRequest.java rename to src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentsLessonResitNotesUpdateRequest.java index 1d2b5c2e..dfd04536 100644 --- a/src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentLessonFinalNoteUpdateRequest.java +++ b/src/main/java/com/graduationproject/studentinformationsystem/university/note/model/dto/request/StudentsLessonResitNotesUpdateRequest.java @@ -6,23 +6,21 @@ import lombok.experimental.SuperBuilder; import javax.validation.Valid; -import javax.validation.constraints.NotNull; +import javax.validation.constraints.NotEmpty; import java.io.Serial; import java.io.Serializable; +import java.util.Map; @Getter @SuperBuilder @NoArgsConstructor -public class StudentLessonFinalNoteUpdateRequest implements Serializable { +public class StudentsLessonResitNotesUpdateRequest implements Serializable { @Serial - private static final long serialVersionUID = -1731196715166066519L; + private static final long serialVersionUID = 4495180748614571012L; - @NotNull - private String id; - - @NotNull - private Double finalNote; + @NotEmpty + private Map resitNoteIdsAndNotes; @Valid private SisOperationInfoRequest operationInfoRequest; diff --git a/src/main/java/com/graduationproject/studentinformationsystem/university/note/service/StudentLessonNoteService.java b/src/main/java/com/graduationproject/studentinformationsystem/university/note/service/StudentLessonNoteService.java index 86440378..4f904e61 100644 --- a/src/main/java/com/graduationproject/studentinformationsystem/university/note/service/StudentLessonNoteService.java +++ b/src/main/java/com/graduationproject/studentinformationsystem/university/note/service/StudentLessonNoteService.java @@ -1,9 +1,9 @@ package com.graduationproject.studentinformationsystem.university.note.service; import com.graduationproject.studentinformationsystem.common.util.exception.SisNotExistException; -import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentLessonFinalNoteUpdateRequest; -import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentLessonMidtermNoteUpdateRequest; -import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentLessonResitNoteUpdateRequest; +import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentsLessonFinalNotesUpdateRequest; +import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentsLessonMidtermNotesUpdateRequest; +import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentsLessonResitNotesUpdateRequest; import com.graduationproject.studentinformationsystem.university.note.model.dto.response.StudentLessonNoteResponse; import java.util.List; @@ -14,9 +14,12 @@ public interface StudentLessonNoteService { List getAllStudentLessonsNotesByStudentId(Long studentId) throws SisNotExistException; - StudentLessonNoteResponse updateStudentLessonMidtermNote(StudentLessonMidtermNoteUpdateRequest updateRequest) throws SisNotExistException; + List updateStudentsLessonMidtermNotes(StudentsLessonMidtermNotesUpdateRequest updateRequest) + throws SisNotExistException; - StudentLessonNoteResponse updateStudentLessonFinalNote(StudentLessonFinalNoteUpdateRequest updateRequest) throws SisNotExistException; + List updateStudentsLessonFinalNotes(StudentsLessonFinalNotesUpdateRequest updateRequest) + throws SisNotExistException; - StudentLessonNoteResponse updateStudentLessonResitNote(StudentLessonResitNoteUpdateRequest updateRequest) throws SisNotExistException; + List updateStudentsLessonResitNotes(StudentsLessonResitNotesUpdateRequest updateRequest) + throws SisNotExistException; } diff --git a/src/main/java/com/graduationproject/studentinformationsystem/university/note/service/impl/StudentLessonNoteServiceImpl.java b/src/main/java/com/graduationproject/studentinformationsystem/university/note/service/impl/StudentLessonNoteServiceImpl.java index 7b5e1b5d..675a9404 100644 --- a/src/main/java/com/graduationproject/studentinformationsystem/university/note/service/impl/StudentLessonNoteServiceImpl.java +++ b/src/main/java/com/graduationproject/studentinformationsystem/university/note/service/impl/StudentLessonNoteServiceImpl.java @@ -3,9 +3,9 @@ import com.graduationproject.studentinformationsystem.common.util.exception.SisNotExistException; import com.graduationproject.studentinformationsystem.university.lesson.common.service.LessonOutService; import com.graduationproject.studentinformationsystem.university.note.model.dto.converter.StudentLessonNoteInfoConverter; -import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentLessonFinalNoteUpdateRequest; -import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentLessonMidtermNoteUpdateRequest; -import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentLessonResitNoteUpdateRequest; +import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentsLessonFinalNotesUpdateRequest; +import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentsLessonMidtermNotesUpdateRequest; +import com.graduationproject.studentinformationsystem.university.note.model.dto.request.StudentsLessonResitNotesUpdateRequest; import com.graduationproject.studentinformationsystem.university.note.model.dto.response.StudentLessonNoteResponse; import com.graduationproject.studentinformationsystem.university.note.model.entity.StudentLessonFinalNoteUpdateEntity; import com.graduationproject.studentinformationsystem.university.note.model.entity.StudentLessonMidtermNoteUpdateEntity; @@ -19,7 +19,9 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; +import java.util.Map; @Service @RequiredArgsConstructor @@ -53,91 +55,107 @@ public List getAllStudentLessonsNotesByStudentId(fina } @Override - public StudentLessonNoteResponse updateStudentLessonMidtermNote(final StudentLessonMidtermNoteUpdateRequest updateRequest) + public List updateStudentsLessonMidtermNotes(final StudentsLessonMidtermNotesUpdateRequest updateRequest) throws SisNotExistException { - final String id = updateRequest.getId(); + final Map midtermNoteIdsAndNotes = updateRequest.getMidtermNoteIdsAndNotes(); + checkBeforeUpdateNotes(midtermNoteIdsAndNotes); - ifStudentLessonNotesAreNotExistThrowNotExistException(id); + final List studentLessonNoteResponses = new ArrayList<>(); + for (Map.Entry noteIdAndNote : midtermNoteIdsAndNotes.entrySet()) { + final String lessonNoteId = noteIdAndNote.getKey(); + final Double midtermNote = noteIdAndNote.getValue(); + final StudentLessonMidtermNoteUpdateEntity noteUpdateEntity = lessonNoteInfoConverter + .generateMidtermNoteUpdateEntity(lessonNoteId, midtermNote, updateRequest.getOperationInfoRequest()); - final StudentLessonMidtermNoteUpdateEntity noteUpdateEntity = lessonNoteInfoConverter - .generateMidtermNoteUpdateEntity(updateRequest); + lessonNoteRepository.updateStudentLessonMidtermNote(noteUpdateEntity); - lessonNoteRepository.updateStudentLessonMidtermNote(noteUpdateEntity); + studentLessonNoteResponses.add(getStudentLessonNoteById(lessonNoteId)); + } - return getStudentLessonNoteById(id); + return studentLessonNoteResponses; } @Override - public StudentLessonNoteResponse updateStudentLessonFinalNote(final StudentLessonFinalNoteUpdateRequest updateRequest) + public List updateStudentsLessonFinalNotes(final StudentsLessonFinalNotesUpdateRequest updateRequest) throws SisNotExistException { - final String id = updateRequest.getId(); - - ifStudentLessonNotesAreNotExistThrowNotExistException(id); + final Map finalNoteIdsAndNotes = updateRequest.getFinalNoteIdsAndNotes(); + checkBeforeUpdateNotes(finalNoteIdsAndNotes); - final Double midtermNote = lessonNoteRepository.getMidtermNoteById(id); + List studentLessonNoteResponses = new ArrayList<>(); + for (Map.Entry noteIdAndNote : finalNoteIdsAndNotes.entrySet()) { + final String lessonNoteId = noteIdAndNote.getKey(); + final Double midtermNote = lessonNoteRepository.getMidtermNoteById(lessonNoteId); - Double meanOfNote; - StudentLessonNoteStatus status; + Double meanOfNote; + StudentLessonNoteStatus status; - final Double finalNote = updateRequest.getFinalNote(); - if (finalNote >= 50.0) { + final Double finalNote = noteIdAndNote.getValue(); + if (finalNote >= 50.0) { - meanOfNote = calculateMeanOfNoteWithFinalNote(midtermNote, finalNote); + meanOfNote = calculateMeanOfNoteWithFinalNote(midtermNote, finalNote); - if (meanOfNote >= 60.0) { - status = StudentLessonNoteStatus.PASSED; + if (meanOfNote >= 60.0) { + status = StudentLessonNoteStatus.PASSED; + } else { + status = StudentLessonNoteStatus.UNFINALISED; + } } else { + meanOfNote = calculateMeanOfNoteWithFinalNote(midtermNote, finalNote); status = StudentLessonNoteStatus.UNFINALISED; } - } else { - meanOfNote = calculateMeanOfNoteWithFinalNote(midtermNote, finalNote); - status = StudentLessonNoteStatus.UNFINALISED; - } - final StudentLessonFinalNoteUpdateEntity noteUpdateEntity = lessonNoteInfoConverter - .generateFinalNoteUpdateEntity(meanOfNote, status, updateRequest); + final StudentLessonFinalNoteUpdateEntity noteUpdateEntity = lessonNoteInfoConverter + .generateFinalNoteUpdateEntity(lessonNoteId, finalNote, meanOfNote, status, updateRequest.getOperationInfoRequest()); - lessonNoteRepository.updateStudentLessonFinalNote(noteUpdateEntity); + lessonNoteRepository.updateStudentLessonFinalNote(noteUpdateEntity); + + studentLessonNoteResponses.add(getStudentLessonNoteById(lessonNoteId)); + } - return getStudentLessonNoteById(id); + return studentLessonNoteResponses; } @Override - public StudentLessonNoteResponse updateStudentLessonResitNote(final StudentLessonResitNoteUpdateRequest updateRequest) + public List updateStudentsLessonResitNotes(final StudentsLessonResitNotesUpdateRequest updateRequest) throws SisNotExistException { - final String id = updateRequest.getId(); + final Map resitNoteIdsAndNotes = updateRequest.getResitNoteIdsAndNotes(); + checkBeforeUpdateNotes(resitNoteIdsAndNotes); - ifStudentLessonNotesAreNotExistThrowNotExistException(id); + List studentLessonNoteResponses = new ArrayList<>(); + for (Map.Entry noteIdAndNote : resitNoteIdsAndNotes.entrySet()) { + final String lessonNoteId = noteIdAndNote.getKey(); + final Double midtermNote = lessonNoteRepository.getMidtermNoteById(lessonNoteId); - final Double midtermNote = lessonNoteRepository.getMidtermNoteById(id); + Double meanOfNote; + StudentLessonNoteStatus status; - Double meanOfNote; - StudentLessonNoteStatus status; + final Double resitNote = noteIdAndNote.getValue(); + if (resitNote >= 50.0) { - final Double resitNote = updateRequest.getResitNote(); - if (resitNote >= 50.0) { + meanOfNote = calculateMeanOfNoteWithResitNote(midtermNote, resitNote); - meanOfNote = calculateMeanOfNoteWithResitNote(midtermNote, resitNote); - - if (meanOfNote >= 60.0) { - status = StudentLessonNoteStatus.PASSED; + if (meanOfNote >= 60.0) { + status = StudentLessonNoteStatus.PASSED; + } else { + status = StudentLessonNoteStatus.FAILED; + } } else { + meanOfNote = calculateMeanOfNoteWithResitNote(midtermNote, resitNote); status = StudentLessonNoteStatus.FAILED; } - } else { - meanOfNote = calculateMeanOfNoteWithResitNote(midtermNote, resitNote); - status = StudentLessonNoteStatus.FAILED; - } - final StudentLessonResitNoteUpdateEntity noteUpdateEntity = lessonNoteInfoConverter - .generateResitNoteUpdateEntity(meanOfNote, status, updateRequest); + final StudentLessonResitNoteUpdateEntity noteUpdateEntity = lessonNoteInfoConverter + .generateResitNoteUpdateEntity(lessonNoteId, midtermNote, meanOfNote, status, updateRequest.getOperationInfoRequest()); - lessonNoteRepository.updateStudentLessonResitNote(noteUpdateEntity); + lessonNoteRepository.updateStudentLessonResitNote(noteUpdateEntity); + + studentLessonNoteResponses.add(getStudentLessonNoteById(lessonNoteId)); + } - return getStudentLessonNoteById(id); + return studentLessonNoteResponses; } @@ -155,6 +173,20 @@ protected final Double calculateMeanOfNoteWithResitNote(final Double midtermNote } + /** + * Checks Before Processing + */ + + private void checkBeforeUpdateNotes(final Map noteIdsAndNotes) + throws SisNotExistException { + + for (Map.Entry noteIdAndNote : noteIdsAndNotes.entrySet()) { + final String lessonNoteId = noteIdAndNote.getKey(); + ifStudentLessonNotesAreNotExistThrowNotExistException(lessonNoteId); + } + } + + /** * Throw Exceptions */