summaryrefslogtreecommitdiff
path: root/addons/survey/static/src
AgeCommit message (Collapse)Author
2021-05-11[FIX] survey: display right date format in datepickerNasreddin (bon)
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#70273 X-original-commit: ddfcecc6c3d013532d06409633a37e653cc05e0f Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
2021-04-29[FIX] *: bunch of mismarked translation specifiersXavier Morel
`_(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#70000 Related: odoo/enterprise#18001 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-01-08[IMP] survey: improve label axis x in chartjs live surveyJérémy Hennecart
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#61913 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-12-09[FIX] survey: use better font for survey reportChristophe Monniez
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.
2020-12-04[FIX] survey, web, web_editor, website, website_form: Prevent invalid date ↵Achraf (abz)
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#62818 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-11-27[FIX] survey: Change certificates designAchraf (abz)
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#62507 Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2020-10-21[IMP] packaging, l10n_dz, l10n_ro, survey: integrate Debian fixChristophe Monniez
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#60114 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-10-12[FIX] survey: let Chart.js handle the session graph max height automaticallyDavid Beguin
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#59106 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-10-02[FIX-IMP] survey: add check on master tabDavid Beguin
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#58987 X-original-commit: d5a1c104278e942f7fe332457c622a51dd647cfc Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-09-29[FIX] survey: fix "multiple choices one answer" keyboard related bugstd-odoo
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#58766 X-original-commit: ad2b4fe9c1ad0f09df33daab3a0784d2d5392fbd Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-09-28[FIX] survey: ensure to retrieve the participant's answer when restartingDavid Beguin
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#58720 X-original-commit: c97c266313aff864f8c397fb1b42f792f9650e5e Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-09-28[FIX] survey: fix trophy background certif in safariJérémy Hennecart
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#58666 X-original-commit: c2747c60161c66f9c77feae884fd101edb693d80 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-09-23[FIX] survey: fix session manager style issuesDavid Beguin
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#58288 X-original-commit: 018a07dc7bba85f5afdd41f8610098a3c493c82a Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-09-07[FIX] survey: fix minor frontend layout issuesAurélien Warnon
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#57212 X-original-commit: f3237a2945ae522218af5a7089097c8d561af2c6 Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
2020-08-04[IMP] survey: animate leaderboard in survey sessionsAurélien Warnon
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-07-28[FIX] survey: avoid autosubmit in session mode or when selecting other optionDavid Beguin
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[FIX] survey: block selection by key when already answered in sessionDavid Beguin
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[FIX] survey: don't show leaderboards if no nickname question in surveyDavid Beguin
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[IMP] web: remove min date limitation of year 1900Harpritsinh Sisodiya
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-04-08[FIX] survey: fix survey timer related issuesAurélien Warnon
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-03-31[IMP] survey: auto submit for questions and matrix with simple choiceDavid Beguin
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[IMP] survey: improve survey form navigationAurélien Warnon
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[IMP] survey: apply small survey form design changesAurélien Warnon
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[IMP] survey: add python tests/tours to test the survey sessionsAurélien Warnon
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[IMP] survey: show matrix choices on session host viewAurélien Warnon
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[IMP] survey: improve sessions fade in/out delaysAurélien Warnon
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[IMP] survey: improve session "short link" managementAurélien Warnon
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-27[FIX] survey: correctly handle "free text sections" in surveys and sessionsAurélien Warnon
We now have a way to display "free text sections" during the survey flow. (Since 5b74f54396f6cf8986494e4632d0ea1b9940619b ) 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[FIX] survey: fix sessions leaderboard & "final leaderboard" displayAurélien Warnon
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[FIX] survey: correctly fade out wrong answer bars in session modeAurélien Warnon
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-17[IMP] survey: allow to add a description on pageJérémy Hennecart
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-09[FIX] survey: remove undefined variable in survey form validationAurélien Warnon
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: 0675d68afb7afe69e5e9d62a172c273a6d0b83e8 Task 2212021 closes odoo/odoo#47174 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-03-06[IMP] survey: integrate conditional questions in session modeDavid Beguin
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[IMP] survey: add conditional questions demo dataDavid Beguin
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[IMP] survey: add conditional display option on questionsDavid Beguin
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-02-27[IMP] survey: improve sessions answers domainAurélien Warnon
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[IMP] survey: improve survey session frontend layoutsAurélien Warnon
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[IMP] survey: add chartjs datalabels plugin libraryAurélien Warnon
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-13[IMP] survey: remove header and footer for all survey mode.David Beguin
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-01-31[FIX] survey: fix datetime pickerJason Van Malder
Fixing 59a50e7628e3, were minDate & maxDate are declared before usage. closes odoo/odoo#44368 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-01-31[IMP] survey: add a 'live session' mode to the survey appAurélien Warnon
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-29[FIX] survey: fix first input autofocusDavid Beguin
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[FIX] survey: ensure same color in community and enterprise while taking surveysDavid Beguin
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-24[FIX] survey: better datetime picker & fix date format issuesJason Van Malder
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-17[IMP] survey : redesign frontend layoutDavid Beguin
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-13[REF] survey: use ajax instead of redirection for screen transitionsDavid Beguin
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-10[REF] survey: remove display mode for simple choice questionsDavid Beguin
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[FIX] survey: fix matrix prepare answer methodDavid Beguin
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[FIX] survey: fix survey "previous page" buttonAurélien Warnon
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>
2019-12-09[REV] web: reverts update to fontawesome 5.11.2Kevin Baptiste
This reverts commit ff1c35513aecef5fbc30f7c2f3834450e719714e. closes odoo/odoo#41480 X-original-commit: 116057b26e71db4692280463669f3e80d813ddcc Related: odoo/enterprise#7110 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>