diff --git a/src/main/java/de/tum/cit/aet/artemis/quiz/service/QuizSubmissionService.java b/src/main/java/de/tum/cit/aet/artemis/quiz/service/QuizSubmissionService.java index 481648fb9636..2018639aec81 100644 --- a/src/main/java/de/tum/cit/aet/artemis/quiz/service/QuizSubmissionService.java +++ b/src/main/java/de/tum/cit/aet/artemis/quiz/service/QuizSubmissionService.java @@ -183,7 +183,13 @@ else if (quizExercise.isQuizEnded()) { // avoid LazyInitializationException participation.setResults(Set.of(result)); + var course = quizExercise.getCourseViaExerciseGroupOrCourseMember(); sendQuizResultToUser(quizExerciseId, participation); + if (course != null) { + // This is required, as sendQuizResultToUser removes the course from the quizExercise + // TODO: This should be fixed by using DTOs in the future + quizExercise.setCourse(course); + } }); quizStatisticService.recalculateStatistics(quizExercise); // notify users via websocket about new results for the statistics, filter out solution information @@ -198,7 +204,7 @@ private void sendQuizResultToUser(long quizExerciseId, StudentParticipation part websocketMessagingService.sendMessageToUser(user, "/topic/exercise/" + quizExerciseId + "/participation", participation); } - // Use a DTO instead of removing data from the entity + // TODO: Use a DTO instead of removing data from the entity @Deprecated private void removeUnnecessaryObjectsBeforeSendingToClient(StudentParticipation participation) { if (participation.getExercise() != null) {