summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/basic_fields.js
diff options
context:
space:
mode:
authorDavid Beguin <dbe@odoo.com>2020-02-06 16:34:47 +0000
committerThibault Delavallée <tde@odoo.com>2020-03-06 10:29:50 +0000
commit0675d68afb7afe69e5e9d62a172c273a6d0b83e8 (patch)
treee8b6e6c16ec9ea0fc8ff08dc3970b7c3d39f663b /addons/web/static/src/js/fields/basic_fields.js
parentfb846dc44acff58ef34e6171231370b528a74280 (diff)
[IMP] survey: add conditional display option on questions
Purpose ======= This commit adds a new survey mode : conditional questions. A conditional question is a question that will be displayed to the user only if the user selects a specific answer from another previous question i.e. question B is displayed if user answers 'Choice 1' at question A. Specifications ============== There are 2 different ways to handle conditional questions. * For one_page and page_per_section survey layout: conditional management is done mainly at frontend side. The idea is to be able to load all the questions of the section, hide the conditional questions and display them dynamically on answer check. E.g.: If user checks answer 'Choice 1' from question A, question B is displayed immediately. If question B is on section 2 and survey layout is set to section per page, question B will be displayed immediately on next page template load. Indeed, on each page load, server sends all the selected answers and the template displays the conditional question depending on the already elected answers; * For page_per_question survey layout: conditional management is done mainly at backend side. The idea is to find on each page the next question to display depending on: * navigation direction (next - previous) * already selected answers and conditional question dependance * survey questions sequence E.g.: If questions survey are Question A, B and C and question B must be displayed if answer 'Choice 1' from question A is selected. At Question A, if user select 'Choice 1' and goes next: display B At Question B, no matter the answer, if user goes next: display C At Question B, no matter the answer, if user goes prev: display A At Question A, if user select 'Choice 2' and goes next: display C At Question C, no matter the answer, if user goes next: End survey At Question C, if user has selected 'Choice 1' at question A and goes prev -> B At Question C, if user has selected 'Choice 2' at question A and goes prev -> A In both modes answers on questions that should not have been displayed to the user depending on the previous selected answers are cleared. E.g. : User checks 'choice 1' from question A, then complete question B. Then user unchecks 'choice 1' -> answer on question B is cleared. Ignore conditional configuration : * during survey session, to avoid having different users answering different questions on the same session. That would be confusing for users to see questions on presenter screen that they didn't have the opportunity to answer; * if survey questions selection is random, because it will not display conditional questions if they are not kept by randomization. To avoid confusion, conditional configuration is simply ignored, not unset, so the user can still reactivate it without having to reconfigure everything. Remove questions that should not have been displayed to the user (depending of the made choices) in scoring computation and print layout. --> Inactives questions are removed from predefined questions when user finish the survey. E.g.: If the user selects first path on 2, he will never see second path. If the user answers correctly to all question of first path, he should have 100%, instead of 50%, even if questions of path 2 are mandatory and scored. Link ==== Task ID: 23509 PR #44950
Diffstat (limited to 'addons/web/static/src/js/fields/basic_fields.js')
0 files changed, 0 insertions, 0 deletions