From 06e1a46c047bc98742016808872b599d7ba18a8d Mon Sep 17 00:00:00 2001 From: David Beguin Date: Fri, 23 Nov 2018 09:53:06 +0100 Subject: [PATCH] [FIX] survey : fix review survey page The prefill of the date field must be done after the initialisation, otherwise, it would override the value. so prefill must be done inside the .then to avoid prefill before the locale is ready. Since the datetime are real datetime in DB, we cannot give real datetime to JSON but string instead. Finally, no need to keep the div class row. Otherwise, it would put everything on same line and the jumbotorn div wouldn't be on top on the rest of the page. Special thanks to @awa-odoo that gave me his masterpiece brain to help me on this. Task ID : 1911291 Closes PR #28966 --- addons/survey/controllers/main.py | 2 +- addons/survey/static/src/js/survey.js | 11 ++--- addons/survey/views/survey_templates.xml | 60 ++++++++++++------------ 3 files changed, 35 insertions(+), 38 deletions(-) diff --git a/addons/survey/controllers/main.py b/addons/survey/controllers/main.py index 3674012e091..856dd1bffd5 100644 --- a/addons/survey/controllers/main.py +++ b/addons/survey/controllers/main.py @@ -185,7 +185,7 @@ class Survey(http.Controller): ret.setdefault(answer_tag, []).append(answer_value) else: _logger.warning("[survey] No answer has been found for question %s marked as non skipped" % answer_tag) - return json.dumps(ret) + return json.dumps(ret, default=str) # AJAX scores loading for quiz correction mode @http.route(['/survey/scores//'], diff --git a/addons/survey/static/src/js/survey.js b/addons/survey/static/src/js/survey.js index 22cef677c45..6542f63a3dc 100644 --- a/addons/survey/static/src/js/survey.js +++ b/addons/survey/static/src/js/survey.js @@ -200,14 +200,13 @@ if(!the_form.length) { allowInputToggle: true, keyBinds: null, }); + // Launch prefilling + prefill(); + if(quiz_correction_mode === true){ + display_scores(); + } }); - // Launch prefilling - prefill(); - if(quiz_correction_mode === true){ - display_scores(); - } - console.debug("[survey] Custom JS for survey loaded!"); }); diff --git a/addons/survey/views/survey_templates.xml b/addons/survey/views/survey_templates.xml index 14746d56150..0375b26626f 100644 --- a/addons/survey/views/survey_templates.xml +++ b/addons/survey/views/survey_templates.xml @@ -341,39 +341,37 @@
-
-
-

-
-
-
- -
-

-
+
+

+
+
+
+ +
+

+
+
+ + +
+

+ + * + +

+
+ + + + + + + +
- - -
-

- - * - -

-
- - - - - - - - -
-
-
-
+
+