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>
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
This commit allow gaining a badge at the end of a certification survey if succeeded.
The badge can be configured on the survey if the certification mode is activated.
The badge is linked directly to the survey and not the challenge,
because it makes more sense to configure directly the reward on the survey and
not the way to gain this reward. As the way is always the same.
Only one badge can be set on the certification survey.
Only the name, description, image and badge level can be configured.
The rest of badge configuration is automatically set to correspond to the use case.
When a badge is configured on a certification survey, the needed challange, goal
and challenge line are autogenerated.
The badge is available on the user's profile page if he gained it.
Once the badge is configured on the survey, he cannot be changed
(remove + create new one), only modified (badge attributes edition).
The only way to remove the badge is to uncheck 'certification_give_badge'.
When removing the badge from the certification survey, all the autogenerated
records (at badge creation) are deleted to avoid ghost records (as they have
no purpose outside of this context). If the badge is owned by someone, the badge
is only archived. If nobody owns the badge, the badge is deleted.
Survey users now have the right to create badges but not challenges or goals.
All the autogenerated records are handled in sudo, to allow the survey user
to configure a badge on their survey.
Note : To avoid having to rewrite the complete context in an xpath expression
only to display the certification badge on the user's profile page,
the default website_published value of the certification badge is defined
directly in the survey module even if survey does not depend of website.
This attribute will be ignored until website module is installed.
Task ID : 1935136
Closes PR #31486
Task #1902306
Purpose
=======
The "page" concept is now only present in the user interface.
Surveys are split in "sections" that have two purposes:
- Organizing a (long) survey/certification
- Allow to pick a random questions count for that section (more information here after)
On the user interface, based on the questions_layout field, surveys are displayed:
- On a single page, where sections still appear but are only used as visual separations
- On multiple pages, having one page per section (this matches the previous behavior)
- On multiple pages, having one page per *question*
On top of that page concept, this commit added randomization for the survey questions.
The randomization mechanism will take X questions per section of the survey.
The survey.user_input is initialized with the selected questions to be sure to keep that
set of questions and avoid showing a new set of questions every time the user refreshes the page.
This also allows to easilly go back and know which question we have to show.
Task #1902306
Purpose
=======
survey.question is now also the model used for the survey's pages (with the "is_page" field set to True).
This allows to put all the pages and questions together in a o2m field on the view side and
easily reorganize your survey by dragging the items around.
It also removes one level of encoding by directly having 'Add a page' and 'Add a question'
links on the tree view of questions, enabling a faster encoding.
However, this has the downside of making the code reading a little bit more complicated.
Efforts were made at the model level to create computed fields so that the use of these models
still seems somewhat logical. That means:
- A survey still has "page_ids" (question_and_page_ids filtered on is_page = True)
- These "page_ids" still have question_ids (questions located between this page and the next)
- These "question_ids" still have a "page_id"
That makes the use and display of these information at view and controller levels easier to understand.
Purpose of this commit is to improve test coverage of survey module. This
commit adds tests related to current access and serve as a base for future
modification. Some tests are commented as access will evolve for this
application.
This commit is linked to task ID 1911586 and PR #28986.
Purpose of this commit is to add a test working with routes and controllers
that check the flow of people going through the portal to fill surveys.
This commit is linked to task ID 1911238 and PR #28831.
Purpose of this commit is to clean existing tests in survey. This commit
* removes unnecessary tests checking that basically create / write correctly
works;
* removes tests based on implementation details;
* cleans tests for validation and answer creation to make them more easier
to read and understand;
* moves invitation tests into their own file;
Some helpers methods are added in common.py to ease question and answer
creation.
This commit is linked to task ID 1911238 and PR #28831.
Purpose of this commit is to clean a bit survey test files before updating
them and creating new tests. In this commit we add a common file holding
user creation and we use the recently-introduced tool method to create
test users. Survey test class is done child of SavepointCase to use
breakpoints and avoid recreating data at each test.
Future commits will gradually remove unnecessary content for test_survey.py,
rewrite part of it to be easier to understand and add new tests.
This commit is linked to task ID 1911238 and PR #28831.