Making a test post_install using @tagged should always remove the
at_install tag.
The main reason for that is that runbot split config select if an
at_install or post_install tests should be executed is using negation:
`--test-tags -post_install`. The reason for that is that giving a positive tag will
replace the "standard" tag and non standard tag could be executed if
giving `--test-tags at_install` (without negation)
Since runbot tests in parallel builds, one of them using
`--test-tags -post_install` and the other `--test-tags -at_install`,
a test that is both post install and at install wont be executed at all.
Also, a tests with both tags will be executed twice
in a normal flow, usually not intended.
The correct way to make a test post_install is to use
@tagged('post_install', '-at_install')
closesodoo/odoo#118969
X-original-commit: d1db306b212d4abb5b2faab9e56c8e83b85c53b9
Related: odoo/enterprise#39966
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
This commit slightly modifies the condition to be considered as a
"scored question" for questions of type simple/multi choice.
Now, to be scored, you need to have at least one correct answer.
This notably allows not showing "incorrect answer: 1" when displaying survey
statistics as there is no way to get it correctly.
Task-3224732
closesodoo/odoo#115322
Signed-off-by: Stéphane Debauche (std) <std@odoo.com>
Move data creation of survey tests from setUp to setupClass as there is no reason
to completely re-create data in between every test and this increases the test
speed without drawbacks.
Task-2199207
Part-of: odoo/odoo#79119
If the method were called on several new questions from different
surveys at the same time (can it happen?),
allowed_triggering_question_ids would include questions from all
surveys for each of them.
A unit test of the method is also included.
Introduced in b1d18562.
Task-3226408
closesodoo/odoo#115930
X-original-commit: e506e8b049c61d5b772370792541b6875d5e5d72
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
Signed-off-by: Florian Charlier (flch) <flch@odoo.com>
According to Wiktionary, French spacing is "the archaic practice (though
still current in French) of inserting a space around colons, semicolons,
question marks, and exclamation marks". This is not standard practice in
English and most languages of the world.
The purpose of this commit is to start purging the code from this typo,
as it may reflect poorly on the software for some people.
closesodoo/odoo#114533
Related: odoo/enterprise#37853
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Purpose
=======
Improve the results page filter to allow the filtering
on questions of type text_box, char_box, numerical_box,
date and datetime.
Specifications
==============
Updating the URL filters representation to avoid passing the
question types directly in the URL parameters.
Answer matching per question type:
- char_box, text_box: 'ilike'
- numerical_box, date, datetime: '='
Adding a new filter restricts the current filter results.
Handling the filters depending on the 2 different answer models:
'survey.question.answer': matrix, simple_choice, multiple_choice
'survey.user_input.line': char_box, text_box, numerical_box, date,
datetime.
The filters can be combined but their query count doesn't add up
if their related answers data are stored in the same model.
Task-3138245
closesodoo/odoo#110252
Related: odoo/enterprise#36383
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
Before this commit, no check was made on conditional questions to see if their
condition was valid when taking a survey.
With this commit, if the survey is not in "random mode" (in which case,
conditions do not apply), there is a check to see that a conditional question
has a valid condition. If not, it is not used in the survey.
Task-3083488
closesodoo/odoo#113303
X-original-commit: f14d1f89ee9c78d481ce1f30ef74bdad9ef0cd7e
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
What are the steps to reproduce your issue?
1/ Setup
* Create a survey with single select multi choice question
* Create a 2nd question which is also a single-select multi-choice
question, which appears based on the answer selected for 1st question.
* Create a 3rd question which is a text question which is visible based
on the answer to question 2.
* All 3 questions are mandatory
2/ Take the survey
* Answer 1st question in a way the 2nd question appears
* Answer 2nd question in a way 3rd one appears
* Change the answer the 1st question in a way 2nd question should not
appear.
3/ Submit the survey
What is the current behavior that you observe?
Odoo will not allow to submit the survey as it will require an answer
for the 2nd question, even though it should not appear.
What would be your expected behavior in this case?
to be able to submit the survey.
A test tour is added to enforce this logic.
opw-3087514
Task-2987929
closesodoo/odoo#112856
X-original-commit: edb0187ee1ec2c45b7059a2a009a1a361e8ae2cb
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Florian Charlier <flch@odoo.com>
When sending the same survey to the same partner, the system detects it and
allows the user to choose between sending a new invitation or resending the
old one so that the user can continue the survey that might already be ongoing.
The detection was not working anymore and this fixes the problem.
Technical note: _compute_existing_partner_ids was intersecting record set
partner_ids (the one currently added) and a record set of partner for which an
invitation has already been sent. The intersection didn't work because
partner_ids relation was not completely set and instead of id, had "origin" id.
Comparing id using a filter solves the problem (using the trick that .ids,
return also the origin ids).
Task-3087702
closesodoo/odoo#111687
X-original-commit: fea798047118f0a482dc2421d92e73f51dd04816
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
Signed-off-by: Dufays Pierre-Yves (pydu) <pydu@odoo.com>
RATIONALE
Improve usage of composer in comment or email mode: support batch-posting in
comment, support more configuration from templates, improve global model.
SPECIFICATIONS
Update report_template field on template model to be a many2many field instead
of a many2one. It allows to attach multiple dynamic reports to a given template
instead of being limited to a single one.
Name should now come from the report itself, which should be considered as
complete by itself. Template cannot override report naming anymore.
Task-2868153 (Mail: Allow multi reports in mail templates)
Part-of: odoo/odoo#99482
## Survey
Due to the behavior of X2Many fields, the questions created when editing
a survey were not usable immediately after creation to be conditional
triggers for new questions. The whole survey had to be saved first, which
wasn't a smooth experience for the user.
This commit will save the survey and question at several times:
### For each new question added
Similarly to what was implemented for chatbot scripts, enables the
immediate computation of allowed question/answer triggers, permitting their
use when chaining question creation.
This also enables to check the answers "validation" fields immediately, and
activating scoring and add scores to question/answers without requiring the
extra steps of saving and re-entering edit mode for the survey.
### When rows are deleted
This will trigger the immediate removal of the triggers icons on
questions that were triggered by an answer to the deleted question.
### NOT when questions are moved
As there is no convenient way to ensure questions are properly ordered with
respect to their triggers (order dependency) without popping error messages
at every step when reordering questions, we chose to mark the misplaced lines,
missing trigger records or triggers that will be ignored (with the new
`trigger` widget).
This could have been done entirely with 'server' logic, but that would have
required additional saves and cleaning fields even more often, even during a
temporary reordering step, which isn't convenient.
### Misc
Finally, note the extra fields added on the question_and_page_ids field of the
survey form view, required to trigger these fields' update consistently
(required after reordering or removing records which sometimes doesn't occur
without these).
Tests ensuring the behavior of the X2Many (saving parent on open/edit and show
notifications on error) and the trigger widget are included.
## web
To support the functionality described above, we need to allow the caller of
'save' to catch errors to prevent default handling (here to use a notification
instead of an additional Dialog).
Task-2623482
Part of odoo#78705
Part-of: odoo/odoo#78705
Before this commit, the state of a question triggering fields could be
inconsistent/corrupted:
* If a question used as trigger for another question was deleted,
`is_conditional` would stay `True` even as `triggering_question_id` would be
`False`, which would eg. prevent saving the question edit form unless this
is not manually fixed.
* If an answer used as trigger was deleted, the triggered question
would never show on a survey session, but still appear as "triggered" and
causing the same trouble on form edition.
In this commit, we
* update `unlink` methods to remove the triggering fields on triggering
question/answer deletion
* add SQL constraint to ensure DB consistency (also improving the survey
cloning/copying behavior robustness)
* add a python test checking this
Task-2623482
Part of odoo#78705
See odoo/upgrade#3613
Part-of: odoo/odoo#78705
Purpose
=======
Simplifying the mail modal used to share surveys
Specifications
==============
* We simplified the modal, you can hide all the parameters for the template creation
* The dynamic values are displayed as computed in the modal
task-2901947
closesodoo/odoo#100705
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
* = crm, mail, survey, test_event_full, website_event
To increase readability and performance, use f-strings where appropriate
(multiple concatenation +- formatting).
Note: Also removing unnecessary string concatenation with `%` for `(i)like`
in domains definitions.
Task-2977548
See odoo/enterprise#31156closesodoo/odoo#99811
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
PURPOSE:
This commit revamps the onboarding data and slightly modifies the integration
of test surveys and related filters.
SPECS
- Revamp sample surveys data:
Considering this is the data we want to push forward, it needs to be as
relevant as possible while being "light" for the db.
- Consider completed test surveys as completed surveys:
Most people expect to see the test the just did counted in the completed
surveys counter in the survey view. The filter excluding the tests surveys has
therefore also been removed from the participation view.
- Rename the filters related to the test surveys:
"Tests Only" and "Exclude Tests" are more straight to the point than
"Test Entries" and "Exclude Test Entries".
- Rename "answer(s)(ed)" at some locations:
"answer" and its various forms are used too often, which sometimes makes it
hard to understand who is who. Therefore, we replaced some of them with
synonyms.
- Set "one page per question" as the default layout. Added the "one_page"
layout in some tests for which the layout was not set.
Task-2794884
Part-of: odoo/odoo#87326
In the web client, in a real use case, it's not possible
to write on fields which are invisible,
as it's not possible to write on fields which are readonly.
This is a first step in the goal to change the behavior
of the `groups=` attribute in the back-end views,
to remove them for the view instead of making them invisible.
This is mainly to reduce the diff of the revision that will introduce
the mentioned above behavior change.
As nodes with `groups=` will be removed from the view
when the user doesn't have the group, it's no longer possible
to set a value on a field having a `groups=` the user doesn't have
in the `Form` test class, as the field will no longer be at all in the
view.
However, these unit tests shouldn't have been able to set values
on invisible fields in the first place.
This revision therefore aims to correct the unit tests setting value
on fields which were invisible because the user executing the
test was not part of the required group(s) for these fields
to be visible in the view.
closesodoo/odoo#94337
Related: odoo/enterprise#28936
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
Currently, in demo data (or data) of some surveys, there are records of
'survey.question' having 'is_page' field value as true and 'question_type'
is not defined. When question type is not defined, default value
'simple_choice' is assigned to the 'question_type' field. Now when we
create a live session of that survey and go to the page, it tries to read
the data for bar chart but data is not available (undefined) and the
traceback is thrown. This happens because question types 'simple_choice'
and 'multiple_choice') are expected to load a bar chart.
It used to work before commit[1] where default 'question_type' value was
being set to 'text_box' (so attempt to load bar chart was not made).
This commit improves the behavior by adapting data/demo data/test cases
and by adding a python constraint that prevents question creation of
page type if there is a question type set, and compute `question_type`
based on `is_page` field. Now that we have python constraint and a
compute method, we no longer need the `default_get` method, so it is
also removed.
commit[1] - https://github.com/odoo/odoo/commit/1fb99d79b1567d4c150dc07f309ce54a3beea8e3
taskID-2841582
closesodoo/odoo#93414
Related: odoo/enterprise#28305
Related: odoo/upgrade#3600
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
PURPOSE
Globally improve the main survey.user_input form view to make it more user
friendly.
This includes fields move, new computed fields, a ribbon, ...
SPECIFICATIONS
- Make the Survey User Input model support mail.thread and mail.activity.mixin
This lets us display the chatter on the form view and allows users to
schedule activities.
e.g: discuss a participation among colleagues, add activities to check some
participation because you think the person has cheated, ...
- Add a ribbon on the form view that says "passed" or "failed" according to the
user result
- Introduce a new "Answer" column for the questions list view that is a
modified 'display_name' that displays the answer based on the question type ;
This allows to see the answers at a quick glance without having to drill down
every question to look at the "value_char_box", "value_datetime", ...
- Add the attempts count information in a stat-button, when clicked, the user
is redirected to the list view of all survey attempts of that specific user
for that specific survey
- Re-organize and move some fields
- Hide some advanced information into debug mode
Task-2729604
closesodoo/odoo#83781
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Allow users to easily duplicate complex surveys that contain questions
displayed based on previous answers.
Currently, when duplicating a survey, the conditional settings are not copied
and the user has to re-do the entire mapping manually.
The implementation adds a post-process that recreates the orginal conditional
display mapping on the new copy of the questions.
Task-2766473
closesodoo/odoo#85117
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Purpose:
The "column choice" is a remainder of a previous implementation in which users
could decide how the survey would look like.
Since the re-design however, this option is no longer working as we prefer
handling this ourselves:
- To make the code simpler
- Because this is not really a "game-changer" feature
- Because we prefer to decide ourselves how the answers will look like to make
sure it always looks nice
As the field is not used anymore and some customers are wondering why it does
not work, we have decided to remove it.
Specifications:
Remove the field column_nb from the survey_question model
In the form, to make sure the "Answers" group is never empty,
we'll move the "Comments" options there instead
Task 2730409
closesodoo/odoo#83645
Related: odoo/upgrade#3231
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
PURPOSE
This commit globally improves the backend survey module usability, notably by
renaming labels, moving menu items around and cleaning unused features.
SPECIFICATIONS
These changes include (non-exhaustive list):
On questions
- Changing labels, action helpers and modules description to be clearer;
- Re-organizing the survey.question form view, notably to clearly distinguish
fields related to answers and validation options;
- Removing the "Clean test answers" server action as it can be done through
a search + unlink;
- Removing the allow_value_image field as we now always display the
image field. Users simply choose to let it blank;
On surveys
- Re-organizing the survey.survey form view fields to get a clear view of
the various options;
- automatically update scoring type when checking certification: if not one
linked to scoring, update to scoring without answers;
- set create as create_multi to speedup batch creation;
- Changes ACL rights for user_input_line. Now, only Survey Managers can
change answers. Survey users keep only a read access on answers, meaning
changing what customers / people answered is now limited to managers;
Globally
- Moving menu items and make them visible outside debug mode;
- Answer recap on print frontend page is now visible whenever a scoring is
applied, not only for certification, as if scoring is activated seeing
answers is probably wanted;
Task-2600241
closesodoo/odoo#79813
Related: odoo/upgrade#3033
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
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
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>
- 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>
Steps:
- Go to Surveys
- Create an new survey:
- Questions:
1. First section
2. First question:
- Multiple choice: only one answer
- Answers:
1. First answer
- Choice: Yes
- Is a correct answer: Checked
- Score for this choice: 1
2. Second answer
- Choice: No
3. Second question:
- Multiple choice: only one answer
- Answers:
1. First answer
- Choice: Yes
- Is a correct answer: Checked
- Score for this choice: 1
2. Second answer
- Choice: No
- Options tab:
- Conditional display: Checked
- Triggering question: (First question)
- Triggering answer: (First question, First answer)
- Options tab:
- Layout: One page per section
- Scoring: Scoring with answers at the end
- Click Test
- Select the two correct answers
- Submit
Bug:
The score is 50% instead of 100%.
Explanation:
Since multiple questions are submitted at the same time, we cannot know
before saving the question whether the following is still going to be
active.
This commit re-evaluates, for each question, which are the ones that are
still active.
opw:2537713
closesodoo/odoo#72126
X-original-commit: ec836acdc7bf10212f14a8bc98eac4cfa2f12e26
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: backspac <backspac@users.noreply.github.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
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
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
Mainly transifex issues but also some errors found through 'grep' checks.
Fix typos and obscure english strings in xml contents, fields strings/helps, some docstrings, ...
ensuring correct translations base (and fallback when translations isn't available).
closesodoo/odoo#57276
X-original-commit: 4214f05d454bca2b60fda3a288d529c098e84f77
Related: odoo/enterprise#13053
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Our CSRF tokens are based on the current user session, and automatically
expire as soon as the session does.
However, they also come with a default 1h expiration delay. This proves
to be a frequent annoyance for users who pause more than 1h on a form
before submitting it (e.g. user logs out and browser sits on login page
until the next day).
It can even lead to blocking bugs, e.g. when the 1h expiration occurs in the
middle of taking a survey exam, and the user is never able to post the
answers that are only present in the state of the form they need to
post.
More generally, users have a hard time understanding those CSRF expiration
errors, and don't know how to react.
Longer default expiration times have been considered (e.g. 1 day or
1 week) but those would not bring any identified benefit in terms of
security, while still giving a chance that some users would experience
the incomprehensible HTTP 400 errors).
Attacks that can typically compromise the CSRF token (XSS, RCE)
can achieve as much, or more, on the system or user account than what is
possible with the token. And nothing generally prevents the attacker
from using the token immediately after capturing it, during the initial
attack, making the expiration delay rather irrelevant.
Given there seems to be no significant benefit in expiring the tokens
before the session itself, let's just keep them valid as long as the
session.
Note: sessions are GC'd automatically after 7 days of inactivity,
which gives an effective 1 week expiry for abandoned web forms anyway,
as the token expires with the session.
Additionally, fix `survey` module tests, that were using an incorrect
regex for extracting CSRF tokens.
closesodoo/odoo#51499
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
Issue
- Install Survey & Contacts
- Have 2 contacts with the same email address
(e.g. test@example.com)
- Create a survey, send it only to that
email address
Email sent 2 times
Cause
When looking for partners linked
to that email address, we do not
provide any limit so the system
send the email to all partners
found.
Solution
If I set one email address,
I expect one email to be sent.
So, the solution would be to
apply a limit of 1 when login
is not required.
OPW-2247693
closesodoo/odoo#51155
X-original-commit: 55b1cc3108d6b672f10ece26db7e13a65ff655d3
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
Purpose of this commit is to clean test that broke nightly recently.
Task ID
closesodoo/odoo#49759
X-original-commit: 61f9b05ccc61a7e00dc5cc43cb1f8196195bee60
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.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
This commit adds a big flow test/tours to the survey sessions, for the host
point of view.
This will avoid breaking the feature with future changes, as it contains some
tricky and complex mechanics (especially the screens chaining).
SPECS
The tour tests the whole host point of view.
Break down of the testing/tour main points:
- Create the survey session
- Check our attendees are accounted for
- Open the 'session manager'
- Display the nickname question, and move to the next one (as answers are not
displayed for nickname questions)
- Check answers are correctly displayed for the 3 'simple' question types
(text, date, datetime)
- Move to the choice question and check that answers are displayed
- If everything is correctly displayed, move to the next question
- On the scored choice question, check that the screens are correctly chained:
no results displayed -> results displayed -> correct/incorrect answers ->
leaderboard
- On the scored + timed multiple choice question, check the same than previous
question, except that the results are supposed to be displayed automatically
when the question timer runs out
- Test the 'back' behavior and check that screens are reversed correctly
- Check that our final leaderboard is correct based on attendees answers
- Close the survey session
LINKS
PR #46768
Task 2208574
Notably
* have tools and helpers in a SurveyCase and let SurveyCommon bet the
one with data;
* remove unnecessary with_user, replaced by standard one;
* move all tools in SurveyCase to help reusing them;
When a random survey does not use all the questions available in a page
because of the random_questions_count field, _get_answers_correctness
was still including them in the skipped category.
This commit ensures that those questions are not included in the result,
and adds a test that checks it.
closesodoo/odoo#47362
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
X-original-commit: 4df43478979766112ae70624deae9c25f40a3349
Adding additional demo and test data for new scorable question types:
'numerical_box', 'date', and 'datetime'. Includes both a scored and
unscored (i.e. answer_score = 0) version for each question type to
ensure differing behavior is viewable in survey results.
Also updating existing data/tests to:
1. Follow American standard for $ placement.
2. Have hardcoded 'answer_is_correct' and 'answer_score' demo data (due
to updated correct answer implementation being done via frontend
input only)
3. Update minor errors in the existing demo data (for example, removing
2nd answer for a single answer choice question for the same survey
submission).
Upgrade PR: odoo/upgrade#835
Task ID: 2061937
PURPOSE
Add a "live session" mode for survey that allows the host to interact with its
audience.
He controls the pace of the survey and the audience answers questions one at a
time.
Results for each question can be displayed by the host to adapt his speech in
real time.
A gamification component even allows to give points to the attendees, based on
the quickness of their answer, and create ranking to keep everyone's attention.
SPECIFICATIONS
This whole feature is deeply integrated with survey.
It adds a layer of "survey session" on top if it that gathers attendees and
answers during the lifespan of the session.
The attendee identity is filled in by a special question that is marked as
"Save as user nickname".
If the host has not configured that question or if the user doesn't answer,
they are marked as "Anonymous" in the rankings.
The answer score computation is also altered during the session to take the
speed of the answer into account.
To ease the access to the survey to attendees, we have introduced two new
routes in the survey main controller:
- '/s/123456'
That uses the 6 first characters of the token to give quick access to the
survey and allow typing the URL manually somewhat conveniently.
- '/s' that renders a view that asks the attendee to enter the survey 'code',
which then redirects to the previous route.
This commit also fixes a few bugs:
- A bugged use case with the "enter key" listener.
When the survey is done, we display a "result template" that shows the user
his score and allows him to retry if possible.
When this template is displayed, we don't want to listen to the "enter" key
that allows to submit the survey form.
- We now correctly remove the timer and initialize the result
widget when the user presses 'enter' on the last page / question.
SURVEY SESSION FLOW
HOST point of view:
- On the Survey Form, the host configures:
- "Reward quick answers" that gives more points to attendees if they answer
quickly
- Question Time Limit, on each question, that defines the time limit for
that specific question, allowing to have different (or no) timer for each
question.
- From the Survey Form, the host can start a "live session"
Only one session per survey can be running at a time.
- When he starts the session, the session_state is marked as 'ready', meaning
all attendees landing on the survey page will be part of the session.
- The host will land on a page showing the current number of attendees as well
as the link for the attendees to join that session.
- The host starts the session, activating the first question of this session.
We keep an active reference to the "current_question_id" and use the bus to
trigger an event that will refresh the survey page for all attendees, showing
them the question and allowing them to answer.
- The host gets a "question management screen", from which he can:
- See the current question text & suggested answers
- See the current question timer
- See the number of answers received for the question
- Display the answers of the question (same view as the survey "results"
page, but only for the question)
- Display the ranking of attendees (if "competitive mode" is enabled)
- The host controls the pace of the survey by moving to the next question until
it's the last one of the survey, then ends the current session.
When the session is closed, we mark the answers of the attendees as "done".
- The host lands on a screen where he sees the survey results and the ranking
of all attendees.
ATTENDEE point of view:
- He reaches the survey when a session and open, and gets a screen asking him
to wait until the host decides to start the session.
- When the sessions starts, he's automatically redirected to the first question
(see above).
- If the session is already started when he reaches the link, he lands on the
current question (and NOT on the first one)
- If the host has configured a time limit, the attendee sees the countdown
while he's answering.
- When the attendee answers the question, the screen tells him the answer is
registered and he has to wait for the host to go to the next question, which
will happen automatically.
- If the timer reaches 0 and he has not submitted his answer, it's too late and
he waits for the next one.
- It continues like that until the end of the session.
- At the end of the session, the attendee gets a screen with his global results
(same as a regular scored survey).
PR #43568
Task 1972640
Co-authored-by: David Beguin <dbe@odoo.com>
PURPOSE
To have a better UX, the transition between questions in a survey should not
be done by loading another page, but by loading next questions in AJAX.
This will allow to fade out / fade in the next question and improve the user
experience, as well as prepare the work for the complete survey redesign.
SPECIFICATIONS
General
=======
This commit refactors the way the questions are loaded.
To go to next question(s), instead of redirecting to a new page containing
the next question(s), the submit process is loading the next question(s)
using ajax. The template of the question is prepared at server side and is
given in html string to the client that display the next question in a smooth
transition (fade in / fade out).
This commit includes also the start and the end screen of the survey inside
the survey form in order to perform smooth transition between start screen
and first question(s) and between last question(s) and end screen.
Only one master template (survey form) is now used to display every part of
the survey : start + questions + end screens.
The answer_done error is now handled by the _prepare_survey_data itself.
If the user wants to display an already_done survey, the returned template
is the end screen.
This commit handles page transition for the survey results. When submitting
survey, the survey result widget is initialized and attached to the survey
result section.
A new route has been added : /survey/begin/.
If the user arrives on start screen, the state is 'New'. Once the user clicks
on Start button, an rpc call is made to survey/begin that will call the
survey_prepare_data to render the first question page and set the state to
in_progress and the start_datetime of the answer.
Validation
==========
Add the validation of all types of questions directly in the frontend.
This allows to reduce the latency before the survey is validated and was
necessary to go along with our new fade out / fade in mechanism.
The client does not need to wait the validation answer from the server to
display validation error messages.
The current questions are only faded out if the frontend validation has passed.
The server still makes this validation before submitting answers and loading
next question(s) to avoid direct rpc calls that would mess up the answers.
Error messages are now displayed with a slide down transition, for a wonderful
wow effect !
Timer
=====
As the survey form works with ajax to display start screen, question(s) and
end page, the timer has to be started only after the start screen.
This commit display and start the timer only after start survey button is
clicked.
Breadcrumb
==========
As the survey form now works in ajax to display in same page start screen,
question(s) and end page screen, the breadcrumb has to be controlled not only
on page loading but also manually between transition from a screen to another.
To ease the breadcrumb management, breadcrumb is now a widget that will reload
a js template, mainly depending of the current page id.
The js form initialize or update this widget giving this new page id.
On breadcrumb item click, the widget triggers a onclick caught by the form
that calls the submit with the given target.
This commit handles page transition for the breadcrumb. When going forward or
backward (next or previous page), the breadcrumb activates, deactivates and
links elements are reinitialized depending of the target page.
LINKS
Task ID: 2152223
PR #41453
Co-authored-by: Aurélien Warnon <awa@odoo.com>
This commit prepares the complete redesign of survey.
Simple choice question type will only use the radio button display mode.
So the dropdown display mode is deleted.
Task ID: 2152223
PR #41453
PURPOSE
As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.
SPECIFICATIONS
Purpose of this commit is to globally rewrite the way statistics are
pre computed and used in results page of surveys. Indeed current code is
very complex, having a lot of calls to the same methods while taking only
part of its results. It also have a mix of model and controller methods,
data is computed several times a bit differently, ...
In this commit we rewrite that part. Including
* a simpler code flow;
* a simpler data structure;
* use a better naming for methods instead of "prepare_results" called
randomly within the code and re-using part of its returned content;
* use record sets / records instead of giving sub-elements of a record
like question.title, label.value, ...
Data structure
* simply give a question_and_page_ids to the template that will iterate
on pages / questions;
* have a graph_data, table_data dictionaries available for graph and
table display with simple entries;
* graph_data: holding all necessary but minimalist data for graph display
if question allows it;
* table_data: holding all necessary but minimalist data for table / summary
display;
* hold record sets of done / failed answers and answer lines;
In this commit we also simplify and clean pagination in survey graph results
* remove page_range helper tool that can be inlined in the templates
directly, doing a simple range;
* fix and improve pagination code;
LINKS
[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)
PR #40765
PURPOSE
As new features are about to land in survey, notably live interactions [1]
and new survey building [2] performing a pre cleaning is necessary. In this
PR we clean survey models by: removing unnecessary fields, cleaning some code
and finally renaming models.
SPECIFICATIONS
To better understand question type and their input type, we update some of
``survey.question`` ``question_type`` keys :
Type----Old type-----New type
text----free_text----text_box
char----textbox------char_box
Untouched question types: ``numerical_box``, ``date``, ``datetime``,
``simple_choice``, ``multiple_choice``, ``matrix``. Those are already
understandable.
Then ``survey.user_input.line`` ``answer_type`` keys are also updated to
match their question type counterparts
QuestType--------Old type-----New type
text_box---------free_text----text_box
char_box---------text---------char_box
numerical_box----number-------numerical_box
Then ``survey.user_input.line`` fields used to store the value are updated to
propagate the new naming
AnswerLineType----Old field----------New field
text_box----------value_free_text----value_text_box
char_box----------value_text---------value_char_box
numerical_box-----value_number-------value_numerical_box
Untouched answer types and field storing value: ``date``, ``datetime`` still
refer to same question type and use value_date / value_datetime fields.
``simple_choice``, ``multiple_choice`` and ``matrix`` still use ``suggestion``
answer type and ``suggested_answer_id`` (+ ``matrix_row_id``) to store link
to ``survey.question.answer`` records.
LINKS
[0] Related to Task ID 2061901 (survey models cleaning and preparation)
[1] Task ID 1972640 (live interactions)
[2] Task ID 2119587 (new frontend for building surveys)
PR #40765