Fix display conditions validations with choices#6837
Merged
tramuntanal merged 4 commits intodevelopfrom Nov 10, 2020
Merged
Conversation
12 tasks
edgarlatorre
pushed a commit
that referenced
this pull request
Nov 11, 2020
* fix display conditions validations cases * fix javascript finding ids for questions. fix answer form test * fix lint * make array order unimportant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎩 What? Why?
Solves a couple of bugs:
when admins create a questionnaire using the logic conditions "match text" and this match involves questions with options (such as matrix questions, single option or multiple options).
The current code tries to use the body of the answer and this is not available if it is a choice, resulting in a 500 error.
Currently, the display_condition method
fulffilled?is used for form validations, and it is checking against responses in the database completely unrelated with the current user. As the answer is being validated is not in the database yet so it should check the rectify form. As the form is not created via a model, new context must be added (the other responses) so an answer validation can get information about the related questions involving display conditions.Matrix questions do not work properly with display conditions. The new approach treats matrixs columns (answer choices) as the source of whats being checked by the user: if the column has a title and the user selects that column in some row, then is a match. This is more predictable.
This needs to be backported to 0.23.
📌 Related Issues
Testing
Describe the best way to test or validate your PR.
📋 Checklist
🚨 Please review the guidelines for contributing to this repository.
docs/.📷 Screenshots
Please add screenshots of the changes you're proposing
