[FIX] survey: validate_multiple_choice with comments allowed
When validating a multiple choice with comments allowed, the comment was popped from answer_candidates and then the condition to prevent answers with blank value always triggered an error. opw:707072
This commit is contained in:
@@ -637,7 +637,7 @@ class SurveyQuestion(models.Model):
|
||||
if self.comments_allowed:
|
||||
comment_answer = answer_candidates.pop(("%s_%s" % (answer_tag, 'comment')), '').strip()
|
||||
# Preventing answers with blank value
|
||||
if all([True if not answer.strip() else False for answer in answer_candidates.values()]):
|
||||
if all([True if not answer.strip() else False for answer in answer_candidates.values()]) and answer_candidates:
|
||||
errors.update({answer_tag: self.constr_error_msg})
|
||||
# There is no answer neither comments (if comments count as answer)
|
||||
if not answer_candidates and self.comment_count_as_answer and (not comment_flag or not comment_answer):
|
||||
|
||||
Reference in New Issue
Block a user