Enforce that questions cannot depend on other question which are asked during checkin (Z#2352753)

This commit is contained in:
Martin Gross
2019-10-14 10:12:09 +02:00
parent 8e9a5e371c
commit eafed2e213
2 changed files with 8 additions and 1 deletions

View File

@@ -249,6 +249,9 @@ class QuestionSerializer(I18nAwareModelSerializer):
dep = full_data.get('dependency_question')
if dep:
if dep.ask_during_checkin:
raise ValidationError(_('Question cannot depend on a question asked during check-in.'))
seen_ids = {self.instance.pk} if self.instance else set()
while dep:
if dep.pk in seen_ids: