BEFORE THIS COMMIT / How to reproduce :
Consider a multiple choice question with single answer.
A. 2 points
B. 1 point
C. -1 point
Here, the user can only select one answer. He picks A. He only obtains 2/3 points.
This is because the maximum score was computed as the sum of all positive scores
for the question. It does not make sense, as the student can only pick one answer.
Therefore, the formula does not allow giving partial scores (here, answer B, close
to the correct answer) while maintaining correct score percentages.
AFTER THIS COMMIT:
The sum of positive scores is still used as maximum score for multiple choice
with multiple answers, as we want the student to pick all good answers for max score.
However, for multiple choice with single answer, we use the maximum positive score
(or 0, if none) among answers, as it the maximum score one can get while selecting
a single answer.
-> example above : I pick A, I obtain 2 points out of max(2, 1, (0)) = 2
-> I obtain max score for the question. 2/2.
ps: As the sum only uses striclty positive values, the negative points are still
operational and the flow is not changed.
TESTS:
A test test_partial_scores_simple_choice is added to make sure the simple_choice
is repaired and always gives 100% of points if the best answer is picked.
Task-2533836
closesodoo/odoo#77426
X-original-commit: 2cdfb7805564943ccf857e49b41d3b597fd727bb
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Currently, if the survey participant does not answer questions of type:
- simple_choice
- multiple_choice
- matrix
The system does not register any survey.user_input_line with the "skipped"
attribute set to True. Meaning that this question's answer will not appear in
the survey statistics as skipped (in fact it will not appear at all).
This commit makes sure we correctly save a user_input_line set as skipped=True
when not answering to those types of questions.
A unit test has been added to make sure that we consider every non-answered
question type as properly skipped within the survey statistics.
Task-2622869
X-original-commit: 87ea302044ff7ac26888000101254b1af2524046
Part-of: odoo/odoo#76606
Calling `_get_answer_score_values` on each question creation or update is
not necessary if value is already provided.
Followup of odoo/odoo@0d32ed45aeclosesodoo/odoo#76223
X-original-commit: c6c7605cdae803aca4f441ef4e622a1b79f17019
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Average duration of each survey is added. To avoid performance issues value
is not stored, and calculated with raw SQL. It requires to have an end
datetime on survey user inputs, allowing to compute average duration it
took people to complete survey.
Live surveys now open in a new tab instead of in-place.
Also rename some css / scss files to ease understanding. Remove unnecessary
class on survey form view.
Task-2634805
PR odoo#72298
Part-of: odoo/odoo#72298
Co-authored-by: David Beguin <dbe@odoo.com>
Co-authored-by: Mariska Archielli <ram@odoo.com>
Co-authored-by: Thibault Delavallee <tde@odoo.com>
If for any reason the initial linked question of one possible answer was
changed and if one existing survey has already been answered using that
possibility, we currently got an Internal Server Error while we should
simply just ignore these answers when getting the statistics of that
survey.
closesodoo/odoo#75758
X-original-commit: 87096c284872f9aa99f5ae9096cee92663c4933e
Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
Currently, while trying to share the survey with 'one page per section'
layout, if the survey has only questions and no sections, a warning is
raised that says 'You cannot send an invitation for a survey that has
no questions'. It is misleading because in this case, what you do not
have is atleast one section with question(s).
This commit fixes the warning message for 'one page per section' type
of survey and gives clear idea to the user about what is missing.
TaskID-2611996
closesodoo/odoo#74694
X-original-commit: 381d18888d81f6797004c718fee5dbd9706b3122
Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
- Create a survey with passing score at 80 point
- Some user complete the quizz with 85 point, the quizz is "passed"
- If you update the passing score at 90, the quizz completed by user are now "unpassed".
This PR avoid to recompute quizz_passed.
closesodoo/odoo#74238
X-original-commit: d5355037545fb8366675b792f8cc5ed30ecca1bf
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit adds a new chart at the end of a scored survey.
Previously, you could see your "Overall Performance", meaning what was your
percentage of correct/partially correct/incorrect/skipped answers for all
the survey scored questions.
Now, we added a new chart new to it that shows the percentage of
correct/partially correct/incorrect/skipped answers but for each section of the
survey.
This allows the user to see in which section(s) he did the most mistakes.
Task-2484885
Updating a completed survey will raise an error with a traceback.
To reproduce the error:
(Use demo data)
1. Survey > Participations
2. Select a completed form
3. Change one answer, Save
Error: A traceback appears "[...] ValueError: Computing score requires a
question in arguments."
Here is an extract from the method concerned:
```python
@api.model
def _get_answer_score_values(self, vals, compute_speed_score=True):
"""
[...]
"""
user_input_id = vals.get('user_input_id')
answer_type = vals.get('answer_type')
question_id = vals.get('question_id')
if not question_id:
raise ValueError(_('Computing score requires a question in
arguments.'))
```
This method needs some information to work properly.
OPW-2488974
closesodoo/odoo#70328
X-original-commit: 62cd2c0be63738f0bbefd62de5d025990e63824f
Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
PURPOSE
=======
For now, the host can't go back to the previous screen on a live session.
Why would he want to go back? Misclick, want to display again the result, other
SPECIFICATION
=============
On a live session, let the host go back to the previous screen.
Do not "restart" the questions but display the graph with the results.
This back capability is independant of the "back button" survey option.
Even if the back button is disabled on the survey configuration, the host must
still be able to go back during a session.
Task ID: 2351759
closesodoo/odoo#59659
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Right now while previewing the certification template, the proper title is not
displayed on the tab of browsers.
This commit improves the behavior by adding name of the certification in title
so that use can see the proper string on browser tab. For doing so, we create
a new wrapper template that sets the title for the page, and use an iframe
to loads the pdf file from existing controlloer (which returns response for the
preview pdf).
Task ID-2341847
COM PR odoo/odoo#66028
This commit enable users to set a 'Responsible' for the survey by
adding 'user_id' field. Demo data for the same is also updated.
Task ID-2389434
COM PR odoo/odoo#62712
ENT PR odoo/enterprise#15217
UPG PR odoo/upgrade#2006
The goal of the draft state on survey is to have the survey under edition
mode before before sending it to participants. Under this mode:
- the responsible can test it (can be done with "In Progress" mode)
- the survey can't be answered (same as the state closed)
The risk that the survey can be leaked before being ready is really
limited. If it's a live survey, participants will have to guess the
4 digits access code and wait for the host to go to the next question.
Else, participant will have to guess the token.
Considering these facts, the use of the draft state is very limited so
'draft' state can be dropped. If we do so, we are left with only two
stages that are 'open' and 'closed'. But whether to consider survey
open or closed can be simply achieved with active field we already
have (if active=False, survey is closed, otherwise it's considered
as open).
So with this commit, we remove the state field from survey and thus
simplify the flow. It means that we no longer require 'Start Survey'
button, and so that button is also removed, and for the closed surveys,
instead of the button 'Set to draft', now we have a 'Reopen' button
which will activate the survey. And instead of displaying few buttons
after saving a record, we now display all the buttons from beginning.
Task ID-2389434
COM PR odoo/odoo#62712
ENT PR odoo/enterprise#15217
UPG PR odoo/upgrade#2006
No need to force a new title on duplicate if something is already given.
Task ID-2265556
PR odoo/odoo#52391
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Before this commit, if a badge is set on the survey, duplicating it always
results into a traceback due to sql constraint. Indeed due to uniqueness
constraints between survey and badge having the same badge for a duplicated
survey was leading to an error.
We had two options
* duplicate the badge itself;
* remove sql constraint and add a required on badge in view when having
a certification (aka, survey giving a badge);
First solution is somehow limited. It means updating badge name, checking
its goal, ensuring all parameters are ok. Moreover it is quite hidden when
duplicating survey. End users will maybe not see what to are doing.
We choose to remove copy flag on flag and badge. That way end users have to
manually re-check the flag, and create a new badge. We remove the hard
constraint and set a required in the view so that functionally behavior
is the same.
Task ID-2265556
PR odoo/odoo#52391
Purpose is notably to display last survey attempt as "Date of certification"
instead of first one. We therefore set an _order on survey.user_input model
(user participation to a survey) as create_date desc. When several attempts
are made the last one will be considered when doing a search with limit=1.
Closes#61362
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
The open_action_with_context was not using _for_xml_id, producing an
error when reading the action content.
In open_action, the action_name was taken from the context and needs
sanity checks. Ensure only actions from the account module can be
read and only if the user has access to the target model.
This is a limitation of the previous behaviour but, at the moment, all
known calls are made refering to an action from the account module.
Limit the scope of this method while the 14.0 is still early to avoid
having a door open to ready any action, and difficult to close later.
Remove old action fetching from the context in create_move that is no
longer used.
closesodoo/odoo#61602
X-original-commit: a39e94f7e4dc74e850650ac90bbc5f85af130bc8
Related: odoo/enterprise#14695
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Co-authored-by: Xavier Morel <xmo@odoo.com>
Use _for_xml_id to replace all the self.env.ref().read()[0]
This has the advantage of having a single point of control and to add
the fields filtering and model verification.
Add sudo for other operations on ir.actions.*
Purpose
=======
This commit intends to improve the animations on the leaderboard during survey
sessions. We now show both the ranking of each attendee before and after taking
into account the current question scores.
It allows attendees to see their position in the leaderboard shifting up / down
depending on how well they answered, and adds a bit more interactivity during
the session.
Specs
=====
The code changes to make this happen implied having multiple layers of
animations running one after the other.
The use of async/await in the JS allowed for a much smoother and less indented
code, simplifying the reading.
We now have 2 different "bars" to handle:
The bar that shows the previous leaderboard position.
The bar that shows the current question score.
This means we handle both jQuery items and modify their size & transition
properties depending on our animation.
Unfortunately, all these animations required a lot of testing to find fitting
timings, which means using quite a few setTimeout with "magic" delays.
These were just the most good looking ones and it feels like naming them with
a constant would not really help.
We also slightly improved the graphic font size / styling to make it easier to
read for potentially far away attendees.
Task 2235815
closesodoo/odoo#50991
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
As there is no session object, it is not possible to generate a randomised set
of questions that will be displayed for all the clients.
When getting the most voted answers while checking which question is the next
one to display, or if this question is the last one, predefined questions are
regenarated each time a fake user input is created (the most voted answers.)
So at the end, while checking if a question is the last one, we compare
different objects.
This is not an issue for non-randomised survey, as everything is constant.
So, until a solution is found to keep information related to a session in
particular, randomised questions mode will be ignored in live session mode.
Task ID: 2230980
X-original-commit: 7f0981c4a61429802a5fe24dd794221b1275dfe3
Unanswered questions or sections are now hidden in the survey review mode.
Only the question answered by the user will be visible.
If the survey was done during a session, the users will see their own answers,
even if the theme they selected was not the most voted one (in case of
conditional questions).
To get the questions to display :
- questions that have been answered
- + the ones that should have been answered = active questions
In session, active questions are based on most voted answers)
This commit also fixes the randomized questions handling in most voted answers,
as copied predefined questions where <NewIds> and those was not usable in
some templates.
Task ID: 2230980
X-original-commit: 8ca79727d5a93b91746c1e63d59d08550417906c
Before this commit, is_last_page_or_question was determined only in function
of next active questions : If there are no active question after the current
one, current question is the last one.
But, in conditional questions context, if the current question is conditionning
the display of latter questions, when we display the current question, we
cannot already know if we are on the last question, as user did not answered
yet.
After this commit, the current question is the last one only if
- there are no active questions that follows
- AND the current question is not conditionning the display of other questions
For page_per_section, we check the same rule for all section's questions.
Task ID: 2232973
X-original-commit: 12d962e579d2480fbf821fb381adebf47668dbcc
As section with description are now considered as potential questions to
display, the method to get the next question to display needs to check if
the next section should be displayed or not, depending on conditional
configuration and user inputs.
For page_per_question and page_per_section layout, the following rule now
applies:
If the section is empty (has no sub-questions):
Show it if section has description, else skip it. (in both layout)
If the section has sub-questions:
If a least one sub-question is active:
In page per section: show it.
In page per question: show if section has description, else skip it.
If no active sub-question: Hide it.
Apply also empty section rules to non conditional survey :
If a section is empty (no description and no active questions inside), the section
should not be displayed.
Task ID: 2230980
X-original-commit: f0ce3623e3cfc2451e3f7359ec09399e6e474c10
Before this commit, when computing the result graph data in the survey finished
page, a user answer for a question with no correct answer was counted twice,
once as correct, once as incorrect, as :
correct_answer == question_correct_answer == none
After this commit, we count an answer as correct only if question has a correct
answer.
Task ID: 2176630
closesodoo/odoo#54755
X-original-commit: 74a00111908556bce10ea3a5e748f5a5c81f6a40
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit fixes all issues detected by the new pylint
gettext-variable test.
It converts some calls to the new syntax
_("Foo %s", bar)
to progressively migrate the code to the new syntax.
A few calls were not technically incorrect but still detected by the
linter.
_("Foo" +
"Bar")
has been converted to
_("Foo"
"Bar")
as it has the same effect and make sure the argument is of type
asteroid.Const instead of BinOp).
closesodoo/odoo#53683
Related: odoo/enterprise#11467
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
PURPOSE
Try to move from onchange / default_get to stored editable computed fields.
Behavior should be the same (computed or set by user), with support of
create / write / onchange field update without additional code.
SPECIFICATIONS
Update classic fields updated in some cases by onchange and/or default methods
by fields with store=True, readonly=False. It means their value comes either
from manual user input, either from trigger based computation.
Remove onchange and default_get when possible, leading to an unique computation
method and clearing fields definition.
Also clean some fields definition inconsistencies, notably required fields
that should instead be correctly computed or default that have no real meaning.
SURVEY USE CASES
- On survey.question, the question_type field should be emptied if the question
is a page (is_page = True)
- On survey.survey, if scoring is configured, the minimum scoring success
should be between 0 and 100 (added SQL constraint).
- On survey.survey, the certification field cannot be True if we're in no
scoring mode (scoring_type = 'no_scoring')
- On survey.survey, the attempts number cannot be limited (is_attempts_limited
is False) if the access mode is public and the login is not required.
- On survey.survey, we cannot give a badge (certification_give_badge is False)
if it's not a certification or if the login is not required.
- On survey.invite, the "subject" and "body" field are based on the template
used (template_id field).
MISC
- As "validation_email" works with "validation_required", we removed the
onchange on "validation_email".
- To avoid extra complexity with an onchange on "is_time_limited" and
"time_limit", we simply default the time_limit field to 10.
LINKS
Upgrade PR odoo/upgrade#847
Task 2187377
closesodoo/odoo#46291
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
- Create a new survey 'Test Survey';
- Add a section 'S1';
- Add a multiple lines text box question 'Q1';
- Add a section 'S2';
- Add a section 'S3';
- Don't move any of the section or question to avoid changing the
sequences, for the moment all the sequences are equal to 10;
- Change the survey layout to 'One page per section';
- Save the survey;
- Test the survey;
- Fill the 'Q1';
- Go to the last page and Submit the survey;
- Review your answers.
Before this commit, the question is empty, this occurs because the
question page_id is not set, in _compute_page_id, the sequence of the
question should be bigger than the question of the page (in this case
the section).
Now, the _compute_page_id was change to take into account the case when
the question has the same sequence as the page (section).
opw-2222045
closesodoo/odoo#49366
X-original-commit: 99f35075e3d1e418e096a29b7440152e746a1cd5
Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
Co-authored-by: Nicolas Lempereur <nle@odoo.com>
This commit fixes timer related issues on survey flows, for both regulars
surveys and survey sessions.
The timer was unreliable in its completion by a whole second, which had not a
big impact at the user level but could make some tests fail (randomly).
Side changes from this commit:
- Reduced delays in the survey session tests to speed up testing
- Removed some timer flickering on survey views
LINKS
Task 2230526
Runbot error ID 535
closesodoo/odoo#49178
X-original-commit: 15c72aec71d42624685fb0fc9df25279c7855310
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
On redirection, werkzeug converts locations from relative to absolute
URLs. Apparently the specific algorithm when given a relative *path*
changed between 0.14 and 0.15, or possibly these paths suddenly became
processed whereas before they were interpreted as absolute?
So in Werkzeug 0.14, `redirect('foo/bar')` was treated as
`redirect('/foo/bar')` but in 0.15 it's first urljoin-ed to the
current path before the redirection is effected.
This is an issue with slides, because survey's get_start_url returns
the url `survey/start/<access_token>` without a leading slash.
The result is that where with 0.14 the certification tour would do this:
GET /slides_survey/slide/get_certification_url?slide_id=39&fullscreen=1
GET /survey/start/<id>?answer_token=<token>
with 0.15 or above it does this:
GET /slides_survey/slide/get_certification_url?slide_id=39&fullscreen=1
GET /slides_survey/slide/survey/start/<id>?answer_token=<token>
Which weirdly enough doesn't work at all.
closesodoo/odoo#48982
X-original-commit: 82a23883748172c05d2562f244ffbc1558ce01fc
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Purpose of this commit is to synchronize active status of certifications to
their badges. When archiving or activating a certification, its badge is also
archived or activated.
Task ID 2170708
Community PR odoo/odoo#46563
Purpose of this commit is to call toggle_active or archive / unarchive methods
instead of manually writing on active field. Indeed this allows to trigger
business code related to archive / unarchive which is normally located
in toggle_archive (called by action_archive and action_unarchive).
Task ID 2170708
Community PR odoo/odoo#46563
Purpose
=======
Speed up survey completion.
Specifications
==============
This commit apply an auto commit when user select a choice on a simple choice
question or on a matrix question with simple choice.
The auto commit happens following those conditions:
- Only on simple choice and matrix with simple choice questions
- For matrix, only when last subquestion is answered
- Only when Back mode is active
- If this is not the last question
Link
====
PR #46768
Task 2208574
This commit slightly changes the way users navigate through the survey form:
- The back button was moved to the bottom-right of the screen.
- The "Continue" button stays at the center but there is also a "next" button
at the bottom-right of the screen (same behavior -> submits the form)
- Arrow keys (left + right) navigation is now supported
Technical note: As the survey navigation is now outside of the survey content,
that was re-rendered on every submit, we have to manually refresh the
navigation with a second template render on the controller side.
LINKS
PR #46768
Task 2208574
PURPOSE
Improve the various sessions flow to make it easier for attendees to reach the
session and to allow better interactions between the host and his audience.
This comes with small usability improvements as well as increased
"beautifulness" by using custom layouts & animations.
SPECS
This commit changes the survey sessions fade in/out delay for both the host
and the attendees.
When going from one question to another, the total delay is now 1 second
(instead of 2 previously), with 500 ms for fade out and 500 ms for fade in.
The previous delay gave an impression of "slowness".
The delays and "server lag reduction" on the attendees side were adapted
accordingly.
LINKS
PR #46768
Task 2208574
PURPOSE
Improve the various sessions flow to make it easier for attendees to reach the
session and to allow better interactions between the host and his audience.
This comes with small usability improvements as well as increased
"beautifulness" by using custom layouts & animations.
SPECS
- For live session only:
Currently, the "short link" feature is good but it still needs to be improved
with the following points:
- Make the default "code" shorter (4) and digit only.
- Allow to customize the "code"
- Check for potential collisions
Added at the same time:
- input element is focused when you land on the '/s' page.
LINKS
PR #46768
Task 2208574
== Fix results scored question display ==
This commit fixes the display for scored choice question.
The text "Right answer" was displayed twice.
== Add default values to avoid constraints inconsistencies ==
This commit adds a 0 default values to some of our validation fields on survey
questions.
Without a default value, the ORM would store "NULL" in the fields and then
allow users to define a "min" without a "max", that would result in an error
while trying to validate the answers to that question.
Furthermore, when creating a question from the frontend, the web framework will
always send 0 for all field values anyway.
The code change adds consistency and avoids potential errors on that issue.
LINKS
Task 2208574
closesodoo/odoo#48371
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
With this commit, Selection fields with `required=True` which are
extended via `selection_add` are given proper ondelete policies to
ensure the cleanup of records containing these extended options during
uninstall of the extending module.
This commit also cleans up leftover uninstall hooks that were being used
to handle the same set of problems prior to the ondelete mechanism being
implemented for Selection fields.
closesodoo/odoo#46325
Related: odoo/enterprise#9117
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
This commit applies conditional questions management on the
"_get_next_page_or_question" method in "page_per_section" questions layout.
We choose the first section that has at least one active question when
searching the next section to display.
Indeed, a whole section could contain only disabled questions based on the
previously selected answers of the attendee.
(The logic is obviously reverted when "go_back" is True).
PR #48442
Task ID 2208574
This commit fixes 2 small problems when the user goes back on the survey form:
- The back button should not be shown on "page_per_question" layout if we are
on the first page of the survey.
Pages can be displayed on "page_per_question" layout if they have a
description since #44271
- Can't go back on "page_per_section" layout if you are on the second page of
the survey, introduced by 0675d68afb
LINKS
PR #48442
Task 2208574
We now have a way to display "free text sections" during the survey flow.
(Since 5b74f54396 )
However, the behavior during survey sessions was not optimal:
- Attendees could click on "submit" and it would raise an error
- The section description was not displayed on the host screen
- The section description was never the "current question" of the session of it
was the first item of the question_and_page_ids
This commit fixes all those points to have a nice session flow.
While the host is explaining the section description to the attendees, they get
a waiting message on their screen.
In addition, we fixed the display to avoid showing pages that lack a
description, and we reworked the '_get_pages_or_questions' method to have more
meaningful and readable cases for every layouts.
LINKS
PR #48442
Task 2208574
Under a survey's results (i.e. summary of all user submissions) the
question type 'numerical_box' has a "Most Common" tab of its results
displaying the top 5 survey user answers. This commit adds the same tab
to question type 'date'. It is expected this tab will be most useful for
'date' questions that are scored.
Implementation was left generic to allow for other question types to
easily adopt similar display. For now, question types: 'text_box' and
'char_box' results do not have a "Most Common" tab since this currently
adds no benefit (once scoring is implemented for 'char_box', then there
may be a benefit for it). 'datetime' is also expected to not benefit
from this additional tab and requires a more complicated implementation
to handle timezone display consistently between tabs and potential
"Right answer" (see related task id: 2169184).
Upgrade PR: odoo/upgrade#835
Task ID: 2061937
Previously only the question_types 'simple_choice' and 'multiple_choice' were
scoreable and could have "correct" answer(s).
In this commit we change this behavior so that question_types 'numerical_box',
'date', and 'datetime' can also have a "correct" answer and an associated
answer_score.
Task ID: 2061937
Community PR #43014
Upgrade PR odoo/upgrade#835
The purpose of this task is to allow the user to create pages which describe
the next survey questions. He can now edit the description in a form when he
clicks on the info icon when he creates or edits a page/section.
Page will be displayed on the frontend in all cases. This allows notably
to have pages with some text / comment for presenters when doing live
action surveys.
Task 2182886
Pr #44271
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Purpose
=======
This commit makes the live session mode work with conditional question.
The point is to determine which question to display next. As multiple users
are 'voting' for answers of the same questions, the way to determine the
next question to display is to keep only the most voted answer.
The most voted answer will be the only one to trigger the linked conditional
question.
E.g.: considering
- following survey configuration:
- Q1: A1, A2
- Q2: triggered by Q1-A1
- Q3: triggered by Q1-A2
- following user inputs:
- U1: A1 selected
- U2: A2 selected
- U3: A2 selected
The next question displayed to ALL users will be Q3.
Note: If U4 had selected A1, the next question would have been Q2 as
when there is an equality, we select the first one.
Link
====
Task ID: 23509
PR #44950
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
This commit improves the answers count in the context of survey sessions as
well as displayed answers to narrow them down to the "current session".
We simply use a custom domain to consider all user_inputs and user_input_lines
that have a create_date after the start of the session.
It will help users to be able to re-use the same survey multiple times and run
different sessions without having to duplicate the survey every time.
LINKS
PR #45111
Task 2191924