prevent empty additional attributes from being saved
This commit is contained in:
parent
7869ceb493
commit
d5d119fe7d
1 changed files with 13 additions and 7 deletions
|
@ -742,14 +742,20 @@ public class ExamDAOImpl implements ExamDAO {
|
||||||
|
|
||||||
private QuizData saveAdditionalQuizAttributes(final Long examId, final QuizData quizData) {
|
private QuizData saveAdditionalQuizAttributes(final Long examId, final QuizData quizData) {
|
||||||
final Map<String, String> additionalAttributes = new HashMap<>(quizData.getAdditionalAttributes());
|
final Map<String, String> additionalAttributes = new HashMap<>(quizData.getAdditionalAttributes());
|
||||||
additionalAttributes.put(QuizData.QUIZ_ATTR_DESCRIPTION, quizData.description);
|
if (StringUtils.isNotBlank(quizData.description)) {
|
||||||
additionalAttributes.put(QuizData.QUIZ_ATTR_START_URL, quizData.startURL);
|
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(
|
if (!additionalAttributes.isEmpty()) {
|
||||||
EntityType.EXAM,
|
this.additionalAttributesDAO.saveAdditionalAttributes(
|
||||||
examId,
|
EntityType.EXAM,
|
||||||
additionalAttributes)
|
examId,
|
||||||
.getOrThrow();
|
additionalAttributes)
|
||||||
|
.getOrThrow();
|
||||||
|
}
|
||||||
|
|
||||||
return quizData;
|
return quizData;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue