Commit Graph
243 Commits
Author SHA1 Message Date
Aurélien Warnon 0e3463a6cb [FIX] survey: fix shortcut usage
Currently, we allow the user to press CTRL+Enter to force the submission of his
answer for that question when the focus is within a textarea.

However, we do not want to submit the question if CTRL+Arrow-right is pressed
(since you may use CTRL+arrows to navigate within your text).
In the same fashion, we don't want to select "option C" if you use CTRL+C to
copy some text in the textarea.

This commit fixes these use cases by only allowing the shortcut handling when
the focus is within a textarea when the pressed key is 'Enter' (code 13).

Task-2716078

closes odoo/odoo#82203

X-original-commit: 69de8e29053119195266379facb8231ba4f51944
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2022-01-04 12:06:49 +00:00
Fabio Barbero f1b1286393 [IMP] survey: display final screen in live presentation
Purpose
=======
When presenting a live survey, the page does not give a
confirmation message when the survey ends and stays on the last slide.
A "Thank you!" message is now displayed when the presentation ends.

Task-2700222

closes odoo/odoo#80447

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-12-14 12:40:04 +00:00
wde-odoo 1fb99d79b1 [IMP] survey: improve survey usability in backend
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

closes odoo/odoo#79813

Related: odoo/upgrade#3033
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-12-01 18:39:45 +00:00
David Beguin fd75481d52 [IMP] survey: add background option per section
This commit adds the background per section feature.
If the section to display has a background image configured, the background
will be refreshed using that section background image.
If the section has no background, the survey background is used.
The background is refreshed at the same time that the next question is loaded.

To ease technical maintenance and to keep it simple, the background is always
faded out/in at each page change only if there are some sections on the
survey that has a specific background image. If no background image are set on
the survey sections, the background will never be faded out.

Note: The next section to display depends on free text (section with
description) configuration and on conditional questions.
The next section to display can be the next question's section or directly
the next question itself (if the question is a section).

This section's background image implementation works both for the regular
survey form as well as the "live session" mode of the survey module.

Task-2225393

closes odoo/odoo#79156

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
2021-11-30 11:20:45 +00:00
Julien BankenandCarlos Valverde dfffa1ed92 [IMP] survey: add an helper to load a sample survey
When the user opens the survey module for the first time, the user may
find it difficult to create and configure a new survey as there are many
options available. To improve the onboarding experience of the user, we
will provide a new link on the action helper of the survey module (for
the kanban and the list view of the surveys).

When the user clicks on that link, the system will open a new modal. The
user will then be able to choose a sample to load. Each sample will be
pre-configured for specific purposes. We will have:

- A sample for the feedback forms
- A sample for the live presentations
- A sample for the certifications

After loading a sample, the user will be able to adapt it to fit their
needs. Thanks to the samples, the user can create a survey more easily
and more quickly.

task-2670605

closes odoo/odoo#79255

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
Co-authored-by: Carlos Valverde <cvs@odoo.com>
2021-11-26 10:31:45 +00:00
Thibault Delavallée d5b688956b [IMP] survey: display a list-kanban when being ungrouped
PURPOSE

When dealing with lot of surveys kanban view is not really optimal and its
state based grouping is not really helpful. Indeed we do not have total of
each coumn and there is not point adding new states, meaning most surveys
hang in the same column. This is not an optimal display.

SPECIFICATIONS

Improve ungrouped display as this is the main usage of surveys. It should
be displayed like a global list view: each card should take the whole
screen (like ``Visitor`` kanban view). Each line contains some "columns"
holding statistics. We notably use a progressbar to display a nice passed
ratio, as well as a many2one avatar widget to make survey enters the era
of amazing wow kanban views.

When grouped, display should be the old one, aka a standard card.

This is done using a small CSS hack: card template actually consists in main
templates related to two displays. Each card style is hidden depending on being
groups or ungrouped. This triggers a class that is used using CSS to hide
irrelevant content.

A ribbon is also added on kanban cards displaying an Archived danger ribbon
when survey is not active anymore. It is therefore coherent with the form
view display that also has a ribbon defined.

An override in website_slides_survey is added to add number of courses using
the survey.

Order is updated so that new surveys are on top. No need to be bloated by
old ongoing surveys when creating new one.

Finally, some labelling is done with answers to be clearer: registered (number
of raw user inputs), completed (finished answers), certified or passed (quiz
with certification activated or not).

Task-2388785

Part-of: odoo/odoo#77227
2021-11-24 14:04:20 +00:00
Aurélien Warnon 77324d5dde [IMP] survey: keep navigation buttons at the same location
This commit slightly adapts the survey navigation buttons to make sure that
they are always positioned at the same spot.

Before this change, if you rapidly click the "back" button a lot of times, when
it disappears, you will misclick the "Odoo" button and land on the Odoo
website, which can be very annoying during a real test with a timer.

Now, we disable the button when it becomes non-clickable instead of removing
it, so that it always stays at the same spot.

Task-2665998

closes odoo/odoo#78513

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-11-16 10:49:13 +00:00
Didier (did) 1afcc9c368 [IMP] bus, mail, *: improve longpolling bus notification format
* = auth_signup, calendar, im_livechat, snailmail_account, survey, test_mail,
    web_editor, website_crm_iap_reveal, website_livechat

The aim of this PR is to improve/fix various flaws and limitation of the current
API, to make it easier to use and more efficient.

Notification are now defined with 3 distinct parts:

- the channel determines which client(s) should receive it
- the type determines how it should be handled
- the payload determines any extra information helpful for handling it

Channel
=======

Business code
-------------

- Record channel is introduced for ease of subscribing to and sending
  notifications to specific partners, channels, documents, ...
- String channel is still supported (but it is converted internally to the tuple
  channel).
- Tuple channel is still supported without any change (but should be avoided
  whenever possible due to its complex syntax).

The channel is no longer sent to the client. When the channel was used for
business purpose, the information it contained has been moved into either the
new type, or the payload itself.

Technical note
--------------

All channels are now internally converted to the tuple (db, ...) channel, which
is necessary for the platform code (saas/sh).

Internally, the bus.bus table is not changed, type and payload are grouped
together into what was (and still is) called message.

Type
====

Type is introduced to uniformize the way notifications are sent and handled.
All existing notifications already had some kind of manually-built type in them.
This is now officially supported at the bus API.

In client code this will allow (to be done in future commits) to register one
handler per specific type, instead of having to iterate and to filter all
received notifications on every handler.

Payload
=======

Payload (ex message) did not change, it can still be anything depending on
business needs.

Few adaptations:
- When the type was included on the payload, the type has been moved to the new
  type parameter.
- When the channel was used in business code, its data has been copied into the
  payload.

task-1891151

closes odoo/odoo#79201

X-original-commit: 543af27c7d6836ffac9e80ff8490b6ddbd849221
Related: odoo/enterprise#21998
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2021-10-29 16:05:23 +00:00
Fabio Barbero 54909f5339 [IMP] survey: update "Press Enter" tooltip depending on field type
Purpose
=======
Have the "or press CTRL+Enter" (metaKey if it's a mac) shown if the input field selected is a text area, and "or press Enter" otherwise.
Hide the text at the beginning of the survey if it's from mobile.

PR: odoo/odoo/pull/77726
Task-2637120

closes odoo/odoo#77726

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-10-18 07:56:17 +00:00
dht-odoo 8281b1ecd5 [FIX] survey: display the absolute counter in time limited survey
Before this commit:
Let's consider the following two scenarios while answering time limited survey:

1) attendee's system clock is de-synchronized compared to the real time
2) Odoo server clock is de-synchronized compared to the real time

In any/both of the above cases, it will lead to a wrong timer display, and will
confuse the user and/or make him fail the test because he will think he still has
more time to submit when he does not.

With this commit:
To fix this, we simply get the offset of server UTC time and moment time, and apply
the offset while calculating the time remaining.

Task-2612972

closes odoo/odoo#77419

X-original-commit: 9e9cd045b2899abc5c8e4a92c43ed6eb2eea158a
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-09-29 20:48:25 +00:00
Aurélien Warnon 7c8cb23aae [FIX] survey: avoid crash for misconfigured questions
Currently, if the user configures his survey with questions of type
'simple_choice', 'multiple_choice' and 'matrix', but doesn't configure any
selectable choices, the survey result page can crash.

This is not really a "standard" use case but this commit adds a few checks to
avoid a complete traceback and instead give empty data results.

Task-2622869

closes odoo/odoo#75586

closes odoo/odoo#76606

X-original-commit: 8051be7c96417cf2feb9d542bb3d230022c8cc54
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
2021-09-16 08:36:06 +00:00
52fedc8e91 [IMP] survey: add average duration on survey
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>
2021-08-31 23:34:55 +00:00
Aurélien Warnon 9c6c77bcc0 [IMP] survey: allow to force submit with CTRL in textareas
This commit adds the possibility to force the form submission by pressing the
CTRL+Enter keys.

Previously, it was not possible to submit a textarea answer using the keyboard.

Task-2484885

closes odoo/odoo#68310

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-04-20 09:43:34 +00:00
Aurélien Warnon 8b3c1b36b7 [IMP] survey: add a "performance per section" chart
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
2021-04-15 12:32:12 +00:00
Nasreddin (bon) d8244c64d9 [FIX] survey: display right date format in datepicker
Issue

	- Install 'Survey' & 'website' module
	- Enable "es_VE" language and activate on main website
	- Go to Website Homepage
	- Switch to "Spanish (VE)" language (footer)
	- Go to "Survey" module
	- Create a survey:
	- Add a question of type 'Date' then save
	- Click on "TEST" button
	- Start survey and add a date with the datepicker
	- Submit survey

	Error message : 'This is not a date'

Cause

	When submit survey, not using the database date format.

Solution

	When validating form (on submit), check if date is formated
	with database format and (not the moment locale since user can
	alter date and datetime format).

opw-2452237

closes odoo/odoo#71228

X-original-commit: f3c5dd794e4de71187fd7532c39595b2297eb93d
Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2021-05-25 14:39:39 +00:00
Xavier Morel 79a4d11e24 [FIX] *: bunch of mismarked translation specifiers
`_(xyz)` will wrap them in an underscore.js object, which when used in
a string context will just return the string. So it's basically a
no-op, but it certainly doesn't translate the terms.

closes odoo/odoo#70476

X-original-commit: 92352ed2b5524c97b0aeeba3193c6a8d93ed82a1
Related: odoo/enterprise#18172
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2021-05-06 12:06:22 +00:00
David Beguin a888b8ee4a [IMP] survey: allow host to go to previous question in session
PURPOSE
=======
For now, the host can't go back to the previous screen on a live session.
Why would he want to go back? Misclick, want to display again the result, other

SPECIFICATION
=============
On a live session, let the host go back to the previous screen.
Do not "restart" the questions but display the graph with the results.
This back capability is independant of the "back button" survey option.
Even if the back button is disabled on the survey configuration, the host must
still be able to go back during a session.

Task ID: 2351759

closes odoo/odoo#59659

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-04-09 11:47:20 +00:00
Elisabeth Dickinson 7321ec0deb [IMP] survey: fixes certification layout, adding dpi and removing width and height in css 2021-03-23 10:08:58 +00:00
Aurélien Warnon f6cb15eddd [FIX] survey: remove global rules applying on all reports
This commit removes 2 css rules that were applied on ALL odoo reports by
mistake.
Indeed, adding rules on "*" and "body" will most likely break other reporting
layouts and is very dangerous / unintended.

If these rules are needed for the survey reports, then it should be fixed to
make them only applied to those reports instead.

We also took this opportunity to get rid of some scss variables.
These variables names were too "global" and could also conflict with other
reporting css rulesets.
If we want to use variables for that report, they should be correctly pre-fixed
to avoid collisions.

Source: 212b107fa1

A proper fix will follow to make the survey reports work properly
(see task-2483393).

Task-2341847

closes odoo/odoo#67836

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-03-15 11:27:41 +00:00
Elisabeth DickinsonandDharmrajsinh Jhala ae4435af84 [REF] survey: implement new certificate templates
Improve certification templates and make them more aligned with current
state of the art certifications.

Task ID-2341847
COM PR odoo/odoo#66028

Co-Authored-By: Elisabeth Dickinson <edi@odoo.com>
Co-Authored-By: Dharmrajsinh Jhala <dja@odoo.com>
2021-03-03 16:13:20 +00:00
Jérémy Hennecart a9ffbbc7ca [IMP] survey: improve label axis x in chartjs live survey
Before when there were long labels, this was leading to an overlapping
of the text.

Now, we display the whole label but in multiline with a maximum number of
characters per line depending on the number of columns.
The font size will also be compute depending of the number of characters
per line and with the length of the longest word in the labels.

task-2382681

closes odoo/odoo#64877

X-original-commit: 58bd6a51041d1c0c011810823caf540995428c2a
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2021-01-21 16:09:36 +00:00
Christophe Monniez e9c16a0119 [FIX] survey: use better font for survey report
TheSecretRegular font license is not clear and moreover, does not
support accented characters.

With this commit, the font is replaced by one under the SIL Open Font
License.

X-original-commit: c455627fe0bf473c437e43831e88e907fc462845
2020-12-14 08:51:41 +00:00
Achraf (abz) 61ae6a6ca1 [FIX] survey, web, web_editor, website, website_form: Prevent invalid date stock.picking
What are the steps to reproduce your issue?

1. Install "stock"
2. Go to Inventory/Inventory Overview/Internal Transfer
3. Create new record and set manually a date with year < 1000 like "0008-10-10 18:35:00"
4. Save
What is currently happening?

An error arises when saving the record, and it is then no longer
possible to reopen the records or any view containing it.
This also prevents us from correcting the date to no longer have the error
Why is this happening?

The root cause is an inconsistency in `strftime` for years < 1000 [1, 2]. To take it into
account, a zero-padding is needed in the DateTime parser.
How to fix the bug?

The missing padding is added.

However, such dates lead to problematic behaviors in Python:

```
DT_FORMAT = "%Y-%m-%d %H:%M:%S"
new_date = "0008-02-05 18:10:10"
datetime.strptime(
    datetime.strptime(
        new_date, DT_FORMAT
    ).strftime(DT_FORMAT),
    DT_FORMAT
)
```

This raises:
```
ValueError: time data '8-02-05 18:10:10' does not match format '%Y-%m-%d %H:%M:%S'
```

As of today there was no reported business cases where dates with year < 1000 would be
necessary. Therefore, we limit the range to years >= 1000.
[1] https://bugs.python.org/issue13305
[2] https://docs.python.org/dev/library/datetime.html#strftime-strptime-behavior

opw-2408260

closes odoo/odoo#62889

X-original-commit: b873bda1e560bc49ab707aa238fdc962f23bc1e4
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2020-12-04 13:35:47 +00:00
Achraf (abz) 01ad020971 [FIX] survey: Change certificates design
This PR decreases the opacity of dark squares and remove the white
background of the logo in the certification templates to make it look better

opw-2387563
https://www.odoo.com/web#id=2387563&action=4043&model=project.task&view_type=form&cids=1&menu_id=4720

closes odoo/odoo#62538

X-original-commit: 1262dfbaea13899147ed47ca35edfc387d21489c
Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2020-11-27 13:42:14 +00:00
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
Victor Feyens 594ccdcbf4 [FIX] *: typos and english incoherences
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).

closes odoo/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>
2020-09-08 18:12:26 +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