Skip to content

Manage conditions to hide or show questions in surveys#5798

Closed
verarojman wants to merge 159 commits intodecidim:developfrom
Platoniq:feature/survey-logic
Closed

Manage conditions to hide or show questions in surveys#5798
verarojman wants to merge 159 commits intodecidim:developfrom
Platoniq:feature/survey-logic

Conversation

@verarojman
Copy link
Copy Markdown
Contributor

@verarojman verarojman commented Feb 26, 2020

🎩 What? Why?

Add new "logic" feature to questionnaires, allowing for questions to have display conditions to determine whether they should be shown, depending on the answer to another question from the same questionnaire.

Condition types are:

  • Answered or Not answered (They check whether the question has been answered or not)
  • Equal or Not equal (They check whether the answer matches a given answer_option or not)
  • Includes text (It checks if answer contains given text, case-insensitively)

A condition can be mandatory or not. All mandatory conditions must be fulfilled for a question to be displayed. If no conditions are mandatory, the question will be displayed if any condition matches.

📌 Related Issues

📋 Subtasks

  • Add CHANGELOG entry
  • Add/modify seeds
  • Add tests

📷 Screenshots

Manage survey - Question with "includes text" condition

Survey Logic - Condition type: Includes text

Manage survey - Question with multiple conditions

Survey Logic - Multiple conditions

Public behaviour video demo:

Survey Logic - Public behaviour

@jesusdb jesusdb self-assigned this May 29, 2020
@verarojman
Copy link
Copy Markdown
Contributor Author

@jesusdb this method is covered and I just added extra specs to ensure that. Are we okay to merge? :)

@jesusdb
Copy link
Copy Markdown
Contributor

jesusdb commented Jun 3, 2020

Great! Now it seems to be covered, but it looks like there are others not covered? Could you please check the answer_option.rb and update_questionnaire.rb?

@microstudi
Copy link
Copy Markdown
Contributor

@jesusdb these files should be covered now. Can you review this, thanks!

@@ -1,10 +1,9 @@
<% field_id = "questionnaire_answers_#{answer_idx}" %>
<% field_id = "questionnaire_responses_#{answer_idx}" %>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One doubt; why changing from "answers" to "responses"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

questionnaire_responses_* is the correct id, I merged from develop and had to change it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jesusdb this may be related to this: #5819 we changed answers to responses to avoid default behavior of Rectify Forms loading answers unnecessarily and causing a heavy penalty performance regression.

Copy link
Copy Markdown
Contributor

@jesusdb jesusdb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work! I just left some little suggestions

verarojman and others added 11 commits June 16, 2020 12:52
Co-authored-by: Jesús Di Bari <61017625+jesusdb@users.noreply.github.com>
Co-authored-by: Jesús Di Bari <61017625+jesusdb@users.noreply.github.com>
Co-authored-by: Jesús Di Bari <61017625+jesusdb@users.noreply.github.com>
Co-authored-by: Jesús Di Bari <61017625+jesusdb@users.noreply.github.com>
Co-authored-by: Jesús Di Bari <61017625+jesusdb@users.noreply.github.com>
Co-authored-by: Jesús Di Bari <61017625+jesusdb@users.noreply.github.com>
Co-authored-by: Jesús Di Bari <61017625+jesusdb@users.noreply.github.com>
Co-authored-by: Jesús Di Bari <61017625+jesusdb@users.noreply.github.com>
Co-authored-by: Jesús Di Bari <61017625+jesusdb@users.noreply.github.com>
@virgile-dev
Copy link
Copy Markdown
Contributor

Hey guys !
@verarojman thanks for the awesome work !
This PR is several months old, we've ordered it to Ivan and our client is showin sign of impatience as we promised it for march. I can see are close to the merge can you guys @jesusdb @tramuntanal can we make it happen before the end of next week ?
Thanks in advance !

@jesusdb
Copy link
Copy Markdown
Contributor

jesusdb commented Jun 26, 2020

@virgile-dev sorry for the delay! And thanks @verarojman, ready to merge!

PR superseded by #6241

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants