Skip to content
Snippets Groups Projects
Commit 9a2b98a2 authored by Ruben Backx's avatar Ruben Backx :coffee:
Browse files

Remove correct grade

parent ccd7fcac
No related branches found
No related tags found
No related merge requests found
...@@ -766,15 +766,11 @@ public class GradeService { ...@@ -766,15 +766,11 @@ public class GradeService {
* @param submissionId The id of the submission * @param submissionId The id of the submission
*/ */
public void removeHighestGrade(Long submissionId) { public void removeHighestGrade(Long submissionId) {
submissionCache.getOrThrow(submissionId).getGrades().stream() Long removed = gradeApi.removeHighestGrade(submissionId).block();
.max(Comparator.comparingInt(GradeSummaryDTO::getScore)) feedbackRepository.findAllByGradeId(removed).forEach(f -> {
.map(g -> feedbackRepository.findAllByGradeId(g.getId()))
.orElse(Collections.emptyList())
.forEach(f -> {
f.setGradeId(null); f.setGradeId(null);
feedbackRepository.save(f); feedbackRepository.save(f);
}); });
gradeApi.removeHighestGrade(submissionId).block();
} }
/** /**
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment