Fixed Exam quiz data update for additional attributes (delete null)
This commit is contained in:
parent
e1c1b10aa3
commit
8828b2f4e8
1 changed files with 18 additions and 7 deletions
|
@ -749,13 +749,24 @@ public class ExamDAOImpl implements ExamDAO {
|
||||||
additionalAttributes.put(QuizData.QUIZ_ATTR_START_URL, quizData.startURL);
|
additionalAttributes.put(QuizData.QUIZ_ATTR_START_URL, quizData.startURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!additionalAttributes.isEmpty()) {
|
additionalAttributes.entrySet().forEach(entry -> {
|
||||||
this.additionalAttributesDAO.saveAdditionalAttributes(
|
final String value = entry.getValue();
|
||||||
EntityType.EXAM,
|
if (value == null) {
|
||||||
examId,
|
this.additionalAttributesDAO.delete(
|
||||||
additionalAttributes)
|
EntityType.EXAM,
|
||||||
.getOrThrow();
|
examId,
|
||||||
}
|
entry.getKey());
|
||||||
|
} else {
|
||||||
|
this.additionalAttributesDAO.saveAdditionalAttribute(
|
||||||
|
EntityType.EXAM,
|
||||||
|
examId,
|
||||||
|
entry.getKey(),
|
||||||
|
value)
|
||||||
|
.onError(error -> log.error("Failed to save additional quiz attribute: {}",
|
||||||
|
entry.getKey(),
|
||||||
|
error));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return quizData;
|
return quizData;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue