diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java index dd17c5ff..847490b8 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/ExamDAOImpl.java @@ -742,14 +742,20 @@ public class ExamDAOImpl implements ExamDAO { private QuizData saveAdditionalQuizAttributes(final Long examId, final QuizData quizData) { final Map additionalAttributes = new HashMap<>(quizData.getAdditionalAttributes()); - additionalAttributes.put(QuizData.QUIZ_ATTR_DESCRIPTION, quizData.description); - additionalAttributes.put(QuizData.QUIZ_ATTR_START_URL, quizData.startURL); + if (StringUtils.isNotBlank(quizData.description)) { + additionalAttributes.put(QuizData.QUIZ_ATTR_DESCRIPTION, quizData.description); + } + if (StringUtils.isNotBlank(quizData.startURL)) { + additionalAttributes.put(QuizData.QUIZ_ATTR_START_URL, quizData.startURL); + } - this.additionalAttributesDAO.saveAdditionalAttributes( - EntityType.EXAM, - examId, - additionalAttributes) - .getOrThrow(); + if (!additionalAttributes.isEmpty()) { + this.additionalAttributesDAO.saveAdditionalAttributes( + EntityType.EXAM, + examId, + additionalAttributes) + .getOrThrow(); + } return quizData; }