Commit Graph
203 Commits
Author SHA1 Message Date
Priyanka Kakadiya 94a6d8d7c9 [IMP] survey: improve UX of survey session code page
This commit improves the UX of the page responsible for joining live
quiz session. Few of the improvements are

  - Increase size of the input tag related to code
  - Display proper error message based on type of error
  - Move the error message below the code input
  - Improve few strings

Along with that, this commit also interchanges the position of
'Add a question' and 'Add a section' options question tabs
of the survey form view.

Task ID-2345907
closes #59060

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-11-16 10:10:43 +00:00
Christophe Monniez c7130babb3 [IMP] packaging, l10n_dz, l10n_ro, survey: integrate Debian fix
With this commit, the executions bits are fixed on some xml, csv and ttf
files. The fix was initialy made at the Debian packaging level.

As xlwt is now in Debian buster, the overide is removed.

The linked fonts in Debian package are now removed in one line to
simplify the code.

closes odoo/odoo#60583

X-original-commit: f31bdc0ae16698306a776332f3aa4aaa1cade764
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-10-23 07:17:29 +00:00
David Beguin 26f4fc093c [FIX] survey: let Chart.js handle the session graph max height automatically
Before this commit, the graph y scale in the survey manager screen was based on
the attendees count. But is some attendees do not answer the question, the bars
never reach the maximum height of the graph, and bars can stay really small.

Example: 10 attendees - 4 answers - A: 1 / B: 1 / C: 2

10 |
   |
   |
   |       |
0  |_|__|__|_
     A  B  C

After this commit, the max height of the graph is not set on the graph. So the
chart lib will handle itself the height and will adapt automatically the bars
height in function of the data given to the graph. Bars will always take full
height space, relatively to the count of the most voted answer.

Example: 10 attendees - 4 answers - A: 1 / B: 1 / C: 2

2  |       |
   |       |
   | |  |  |
0  |_|__|__|_
     A  B  C

Task ID: 2351455

closes odoo/odoo#59777

X-original-commit: ac64af033f0bbaa698aee424a5cab85fd9b967d2
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-10-12 15:18:48 +00:00
David Beguin 851e68ef40 [FIX-IMP] survey: add check on master tab
As survey session only works correctly when current tab is the master tab
on the bus, an error message is shown to user when this is not the case.

The user should close all other tabs on the same hostname before taking
the survey.

Task ID: 2345468

closes odoo/odoo#58989

X-original-commit: d5a1c104278e942f7fe332457c622a51dd647cfc
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-10-02 12:12:07 +00:00
std-odoo 8bba8852b8 [FIX] survey: fix "multiple choices one answer" keyboard related bug
Bug
===
1. Create a survey with the option "One page per question"
2. Create a "Multiple choice - only one value" question
3. Go to the survey, select a question
4. With the keyboard unselect the question
5. Submit

You will be able to submit your answer even if nothing seems to be
selected.

We also want to be able to unselect answers with the keyboard.

Technical
=========
The event "onchange" can be triggered for the radio button even if there
was no change. The reason is because we always "write true" on the radio
(even if it was already check) and we always trigger manually the event
"onchange".

Task-2345463

closes odoo/odoo#58771

X-original-commit: ad2b4fe9c1ad0f09df33daab3a0784d2d5392fbd
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-09-29 09:31:30 +00:00
David Beguin 1f9cd08234 [FIX] survey: ensure to retrieve the participant's answer when restarting
In order to avoid making it possible to follow the same survey multiple times
at the same time, a survey cookie is added with the survey token and answer
token.

When starting the survey, if the cookie contains a valid answer token for that
survey token, the survey session is reloaded where the participant left it.
When the user finished the survey, the cookie is deleted to allow to retake the
survey later, if possible.

Note: A participant can still open multiple tabs with the same survey, but it
will be linked to the same survey answer. So if the user tries to submit another
answer, the late answer will overwrite the previous one.

Task ID: 2345468

closes odoo/odoo#58728

X-original-commit: c97c266313aff864f8c397fb1b42f792f9650e5e
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-09-28 16:58:13 +00:00
Jérémy Hennecart 1cfd35cc97 [FIX] survey: fix trophy background certif in safari
Fix weird behavior between linear-gradient and background-size
with safari, if we don't set the value for linear-gradient.

task-2334731

closes odoo/odoo#58673

X-original-commit: c2747c60161c66f9c77feae884fd101edb693d80
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-09-28 12:29:04 +00:00
David Beguin eccf8b9f5c [FIX] survey: fix session manager style issues
This commit fixes a bunch of small issues on the session manager.
- Put the progress bar below survey link to optimise available room for title.
- Ensure attendees count is also updated when refreshing the results
and progress bar.
- Ensure the graph is correctly setup when there is no attendee yet.
- Update y axis in chart when new attendee join the survey in the middle of
a session.
- Set padding top to chart to avoid top bar label to disapear from chart if bar
is near 100%.

Task ID: 2343508

closes odoo/odoo#58291

X-original-commit: 018a07dc7bba85f5afdd41f8610098a3c493c82a
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-09-23 08:11:09 +00:00
Aurélien Warnon 8a27e5336b [FIX] survey: fix minor frontend layout issues
This commit fixes 2 minor issues with the survey frontend layout:
- When hovering an answer option, the word "key"'s offset only worked properly
  for a 3 letters word.
  This does not comply with possible translations and the scss was adapted to
  display correctly with any string.
- The "Continue or press Enter" block needlessly took 2 rows of space if the
  text was slightly longer.
  We provided more space to account for possible longer translations.

Side note: we also added parenthesis between the "add" property on the
"wrapwrap" element XML inherit to ease subsequent overrides.
(Otherwise, the next override would add its own value within our "if else"
statement and that could cause issues).

Task 2334823

closes odoo/odoo#57216

X-original-commit: f3237a2945ae522218af5a7089097c8d561af2c6
Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
2020-09-07 16:56:09 +00:00
Aurélien Warnon 4abe3ea9c7 [IMP] survey: animate leaderboard in survey sessions
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

closes odoo/odoo#50991

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-08-04 07:47:25 +00:00
David Beguin d271c32058 [FIX] survey: avoid autosubmit in session mode or when selecting other option
In Session Mode:
Before this commit, autosubmit was only dependant of the back button,
but not of the session mode. In session mode, back button is ignored,
and auto-submit sould not happen in session as user has not the possibility
to go back in case he misclicked.

After this commit, the auto-submit only happens if back button is activated AND
if we are not in session mode. This is already checked inside
survey._can_go_back method and already given to the template.

When selecting 'other' option:
For a single or multiple choice question, if the user is selecting the
'Other' choice, Auto submit should not happen. Otherwize, the user has not the
possibility the type his custom answer.
Also, if the question has comment that does not count as answer, the user
should still be able to add a comment after having selected the answer.
The comment can be a complement of answer.

Task ID: 2230980

X-original-commit: 7f03380b49a55f3c2e36f379043c33a8a17f49ed
2020-07-28 08:03:35 +00:00
David Beguin 2efc4678bc [FIX] survey: block selection by key when already answered in session
Before this commit, during a session, it was still possible to select another
choice (in a multiple choice question) even after having selected and submitted
an answer.

After this commit, if the question has already been answered or time limit
already ran out, it's not possible to use key to select another choice.

Task ID: 2230980

X-original-commit: e1acda0493092f5020576fc30768141a99b9fd48
2020-07-28 08:03:33 +00:00
David Beguin cbc8085761 [FIX] survey: don't show leaderboards if no nickname question in survey
Before this commit, after each scored question, a intermediate leaderboard was
shown, before going to the next question, even if no 'nickname' question was
present in the survey. So that the leaderboards were display only 'anonymous'
attendees, which is not really useful. Also, after last question, the final
leaderbaord was not shown and the survey was closed immediatelly, which was not
really coherent (show intermediate leaderboards but not the final one).

After this commit, the leaderboards and the final one are shown only if a
nickname question is present on the survey, so attendees can identify
themselves and retreive their ranking on each leaderboards.

Task ID: 2230980

X-original-commit: dd409de096c48f22476aff3f37526bc76c1cde12
2020-07-28 08:03:31 +00:00
6aa6c321a6 [IMP] web: remove min date limitation of year 1900
Before this commit, user could not selecta a date before year 1900.
This was an historical limitation due to python < 3.2 that didn't
support dates before 1900.

After this commit, user can select any date, user can select any
date from 01/01/0001.

taskID: 2166761
Fixes #41788
Closes #43055

closes odoo/odoo#51406

Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
Co-authored-by: Mohammed Shekha <msh@odoo.com>
Co-authored-by: Aaron Bohy <aab@odoo.com>
2020-07-28 14:02:10 +00:00
Aurélien Warnon f4803d548b [FIX] survey: fix survey timer related issues
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

closes odoo/odoo#49178

X-original-commit: 15c72aec71d42624685fb0fc9df25279c7855310
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-04-08 07:33:14 +00:00
David Beguin 280c6bf1d6 [IMP] survey: auto submit for questions and matrix with simple choice
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
2020-03-31 16:25:53 +00:00
Aurélien Warnon 176e5a5066 [IMP] survey: improve survey form navigation
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
2020-03-31 16:25:52 +00:00
Aurélien Warnon 695294b953 [IMP] survey: apply small survey form design changes
This commit slightly improves the survey form by adding a few cosmetic changes,
notably:

- Add/reduce some margins/paddings
- Adjust colors/font-weight
- Adjust heights
- Change some icons by more fitting replacements
- Center matrix choices
- Move survey progression to bottom-right
- Remove ugly jumbotrons
- Hide survey title in page_per_question layout
- When there are 5 or less option for simple_choice or multiple_choice
  questions, display the options vertically.
- Only show the textarea for the "comment answer" if the user clicks on the
  related option.

One of the biggest design change is the introduction of a "minimized layout"
that reduces the width of some question types on bigger screen.
This gives a cleaner look to the survey form.
Impacted question types:
- Numeric
- Date
- Datetime
- Simple / Multiple choices

Technical note: As the survey progression is now outside of the survey content,
that was re-rendered on every submit, we have to manually refresh the
progression with a second template render on the controller side.

Small fix addition:
We also fix the matrix key selection feature in case the matrix had a total of
more than 25 options, which would raise an error.
Indeed, they "use key selection" condition only checked the number of rows,
and not the rows * columns (total number of options count).

LINKS

PR #46768
Task 2208574
2020-03-31 15:43:03 +00:00
Aurélien Warnon 6405ffd483 [IMP] survey: add python tests/tours to test the survey sessions
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
2020-03-31 15:16:02 +00:00
Aurélien Warnon afd78f12ae [IMP] survey: show matrix choices on session host view
This commit improves the session host view by showing matrix choices for matrix
questions.

This is done to help people in the audience that are not participating to the
session to have some context about possibles question answers.

LINKS

PR #46768
Task 2208574
2020-03-31 15:12:06 +00:00
Aurélien Warnon aaf3cb50c3 [IMP] survey: improve sessions fade in/out delays
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
2020-03-31 15:12:05 +00:00
Aurélien Warnon a330099b92 [IMP] survey: improve session "short link" management
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
2020-03-31 15:12:04 +00:00
Aurélien Warnon 8d09178b42 [FIX] survey: correctly handle "free text sections" in surveys and sessions
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
2020-03-27 15:03:32 +00:00
Aurélien Warnon 090f9ad333 [FIX] survey: fix sessions leaderboard & "final leaderboard" display
This commit fixes a problem where the "final leaderboard" would duplicate the
attendees ranking display if the last question of the survey is scored.

We now also directly close the session when the host hits "next" on the last
question and there is no leaderboard to display.

LINKS

PR #48442
Task 2208574
2020-03-27 14:52:49 +00:00
Aurélien Warnon 721c34ccc9 [FIX] survey: correctly fade out wrong answer bars in session mode
This commit fixes the faded out answers bars on choice questions during a
survey session.
The logic is currently inverted (correct answers are faded out instead of wrong
ones).

LINKS

PR #48442
Task 2208574
2020-03-27 14:52:32 +00:00
Jérémy Hennecart 5b74f54396 [IMP] survey: allow to add a description on page
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>
2020-03-17 09:37:37 +00:00
Aurélien Warnon 825d687cca [FIX] survey: remove undefined variable in survey form validation
This commit removes an unused and undefined variable that raised an error when
the user tries to answer a mandatory char_box question.

Oversight of commit: 0675d68afb

Task 2212021

closes odoo/odoo#47174

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-03-09 09:41:13 +00:00
David Beguin 2d499c0236 [IMP] survey: integrate conditional questions in session mode
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
2020-03-06 10:29:50 +00:00
David Beguin 3968bed239 [IMP] survey: add conditional questions demo data
Purpose
=======

This commit adds demo data to illustrate the conditional questions
configuration. Users will be able to choose among 4 themes. Depending on their
choice(s), the survey will continue by displaying only the questions related
to the selected theme(s).

Link
====

Task ID: 23509
PR #44950
2020-03-06 10:29:50 +00:00
David Beguin 0675d68afb [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
2020-03-06 10:29:50 +00:00
Aurélien Warnon 0e43becd91 [IMP] survey: improve sessions answers domain
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
2020-02-27 16:40:57 +00:00
Aurélien Warnon de2fa26165 [IMP] survey: improve survey session frontend layouts
PURPOSE

Improve layouts and usability for the host screens when using survey sessions.
We focus on the "host" screens, as the attendee screen is based on regular
survey flows/design.

SPECS

In short: copy mentimeter "wow effect".

Main points:

- Remove the "question" container (keep only "Results/Ranking")
- Remove the tabs concept, views are displayed in full screen
- Purpose is to have a "clean view"
    - The display must be "full screen" with only relevant info
    - Enable a easy keyboard navigation with left/right keyboard arrows
      and spacebar
- Switching from results to ranking to next question is always linear
  (next/previous instead of tabs)
- Improve charts
    - Remove the pie chart : make bar charts instead for simple / multiple
      choices
    - Show the chart results "as people answer to it"
      Only if question is not scored, otherwise show when all answers are
      received / when user goes to "next"
    - For free text/date/datetime: show small bubbles with attendees answers
- Add resize, fade in/out, ... animations for "wow effect"

LINKS

PR #45111
Upgrade PR odoo/upgrade#774
Task 2191924
2020-02-27 16:40:57 +00:00
Aurélien Warnon 84e128980c [IMP] survey: add chartjs datalabels plugin library
This commit adds a chartjs 'datalabel' plugin in the survey module.
It is a preparation commit for the general layout improvement of the survey
'live' session feature.

Task 2191924
PR #45111
2020-02-27 16:40:57 +00:00
David Beguin 732cb7c254 [IMP] survey: remove header and footer for all survey mode.
Purpose
=======

Lighten the survey layout. it should be free of website footer and header.

Specifications
==============

Survey Layout inherits from web.frontend_layout, mainly to be able to use all
the styles rules defined in it and keep consistency between other frontend
pages and survey.

Instead of inheriting another layout, this PR sets no_footer and no_header to
True for all survey layout. The idea is to show only the survey itself without
having other web/website object in the layout.

Links
=====

Task ID: 2195185
PR #45112
2020-02-13 15:29:00 +00:00
Jason Van Malder 83f2811217 [FIX] survey: fix datetime picker
Fixing 59a50e7628, were minDate & maxDate are declared before usage.

closes odoo/odoo#44368

Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-01-31 13:43:20 +00:00
Aurélien WarnonandDavid Beguin e973bd5519 [IMP] survey: add a 'live session' mode to the survey app
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>
2020-01-31 14:35:48 +00:00
David Beguin be5e86f464 [FIX] survey: fix first input autofocus
Before this commit, the survey form widget was focusing on the first text
input found on the page, even if this input was not the first question.

After this commit, the survey form widget focus only on first text input
if that input is the first question on the page.

Triggered by task ID 1972640 (live sessions on survey)
PR #44205

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-01-29 14:54:10 +00:00
David Beguin a8b3800a9c [FIX] survey: ensure same color in community and enterprise while taking surveys
Use $primary to always get same color in COM and ENT. The goal of using color
variable for styling is to get always the same color, no matter if we are in
community or on enterprise.

Before this commit, *$o-brand-primary* was used in survey stylesheet but this
variable is not matching the same colors in COM and in ENT.

After this commit, *$primary* is used to render the same color no matter the
environment (COM or ENT).

Triggered by task ID 1972640 (live sessions on survey)
PR #44205
2020-01-29 14:33:36 +00:00
Jason Van Malder 59a50e7628 [FIX] survey: better datetime picker & fix date format issues
Issue

    - Install Surveys & Website
    - Create a survey with a datetime question
    - Install Spanish lang & set it up on website as the only language
    - Surveys > Your survey > Test

    Traceback

Cause

    There is a format mismatch because of field_utils.format.datetime
    but it's needed for timezone offsets.

Solution

    Format the field_utils.format.datetime result's into
    the datetimepicker format.

    I re-organized this part because it was a bit confusing and
    it handles error now.

OPW-2167397

closes odoo/odoo#43912

X-original-commit: b368b1db4a998a2369185218fe19fb84874f77ab
Signed-off-by: Jason Van Malder (jvm) <jvm@odoo.com>
2020-01-24 12:48:48 +00:00
David Beguin aedeccbeea [IMP] survey : redesign frontend layout
In this commit, all the questions type have been redesigned to look more fancy.
(impacted question types : radio and checkboxes, text boxes (textarea and text
inputs, date and datetime inputs and matrix)

For radio and checkboxes, both design have been aligned to work the same way
(except checkboxes can still have more than one selected option).
Selection by key have been applied on those two question types if the number of
option is under 26 (to use all the alphabeat character for selection). This
selection by key is only available on page per question layout.

Tests have been adapted accordingly to the redesign (typically for choice and
matrix inputs)

* Progress Bar

This commit adds a progress bar to the survey to inform the user
where he is in the survey filling process.

There are two progress modes:
    - Number : will display the number of the current page on the total number
    of pages (or questions if layout mode is question_per_page)
    - Percentage : will display the percentage of page or question already done

So this leads to, on last page:
    - in Number mode :
    the progress bar div is 100% filled         3 / 3 pages   [===]
    - in percentage mode :
    the progress bar is aligned to percentage   66% completed [== ]

* Print Widget

A widget is added for survey print mode in order to resize all textarea to fit
their content, instead of showing a scroll bar. This can be usefull if user
wants to print the results. He will get the entire content of the 'textarea
answers' instead of only the two first lines.

* Misc

This commit also :
    - adds background image to survey.
    - redo quizz correction and add some data to illustrate non scored
    questions rendering in print template
    - review breadcrumb style

Note : readonly data option on survey form widget is not set anywhere yet but
the usage is done in prevention of the future work on presenter view for survey
session mode.

Task ID: '2150291'
PR #43237
2020-01-17 16:04:17 +00:00
David BeguinandAurélien Warnon 4a7c84e696 [REF] survey: use ajax instead of redirection for screen transitions
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>
2020-01-13 15:50:14 +00:00
David Beguin 792d71faf5 [REF] survey: remove display mode for simple choice questions
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
2020-01-10 11:01:04 +00:00
David BeguinandAurélien Warnon 8f3d82720a [FIX] survey: fix matrix prepare answer method
The matrix data structure awaited by the server is the following :
{
    question_id: {
        'row_id_1': ['col_id1', ..., 'col_idn'],
        'row_id_n': ['col_id1', ..., 'col_idn'],
        'comment': 'This is a comment',
    }
}

Before this commit, the comment was encapsulated into a dict, into an array,
with an incorrect key :
    -> 'questionId_comment': [{'comment': 'This is a comment'}]

This was leading to 2 errors :
- A traceback when nothing is selected in the matrix options
- Comment is never saved.

After this commit, the comment is correctly given to and extracted by the
server. So the comment is saved and the traceback is avoided.

Task ID: 2152223

closes odoo/odoo#43086

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Aurélien Warnon <awa@odoo.com>
2020-01-10 06:51:50 +00:00
Aurélien Warnon 2d4711a3b9 [FIX] survey: fix survey "previous page" button
This commit fixes the "back button" that appears when the user is taking the
survey, allowing to go back to previous pages or questions.

There was a typo in the name of the parameter.

Task 2152223

closes odoo/odoo#43003

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-01-10 06:50:02 +00:00
Kevin Baptiste 6cbe824871 [REV] web: reverts update to fontawesome 5.11.2
This reverts commit ff1c35513a.

closes odoo/odoo#41480

X-original-commit: 116057b26e71db4692280463669f3e80d813ddcc
Related: odoo/enterprise#7110
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-12-09 10:33:36 +00:00
Thibault Delavallée 351a4439b3 [REF] survey: clean results page and its code generating statistics
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
2019-12-05 15:21:28 +00:00
Thibault Delavallée bb3d4634df [FIX] survey: lint JS files and reorganize route code
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

This commit lints JS files located in survey as some typos and mistakes
were recently introduced. Code related to routes is also slightly reorganized
to better understand file main sections.

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
2019-12-05 15:21:28 +00:00
Thibault Delavallée 0406b7049e [REF] survey: on survey.{question,user_input.line}, make type and field names match
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
2019-12-05 15:21:28 +00:00
Thibault Delavallée 755ac5f313 [REF] survey: on survey.user_input, rename some fields to ease understanding
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: RENAME QUIZ_SCORE ON SURVEY.USER_INPUT

On survey.user_input, quiz_score field to scoring_percentage

``quiz_score`` field name is related to the old "quiz" behavior of surveys
that is replaced by certifications and scoring mechanisms. Let us propagate
the renaming, beginning with a ``scoring_`` prefix.

SPECIFICATIONS: RENAME QUIZZ_PASSED ON SURVEY.USER_INPUT

on survey.user_input, rename quizz_passed field to scoring_success

``quizz_passed`` field name is related to the old "quiz" behavior of surveys
that is replaced by certifications and scoring mechanisms. Let us propagate
the renaming, beginning with a ``scoring_`` prefix.

SPECIFICATIONS: RENAME TOKEN ON SURVEY.USER_INPUT

on survey.user_input, rename token field to access_token

Survey user input model holds two token field. One is used to distinguish
a pool of attempts linked to a given invite: ``invite_token``. The other
one is used to control access to a specific user input. It means that
``invite_token`` indicates a set of user inputs and each of them is accessed
through its own ``token``. To be coherent with other naming in odoo this
latter field is renamed to ``access_token``.

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
2019-12-05 15:21:28 +00:00
qmo-odoo 74854ebf2c [FIX] survey: Fix traceback when creating a question in mobile
This commit fixes the traceback that happens when we try to create
a question from the survey form in mobile mode.

The problem was due to the context not being propagated
to the "add record" button that appears in mobile mode.
Therefore, as we use that context in our widget, it crashes.

The solution to this is to just use the normal tree view behaviour
instead of our override when we are in a mobile environment.

LINKS

Taskid: 2071342
Pr: #40694
X-original-commit: b394a67ccd527b4ff88f0b59083fd3b59cf97681
2019-11-29 15:59:26 +00:00