From 14b7eff7c294aa2b18edf0a6eda8201ec76ed93b Mon Sep 17 00:00:00 2001 From: Patrick Hoste Date: Thu, 16 Mar 2023 09:20:43 +0000 Subject: [PATCH] [IMP] survey: move scoring graph data to review answer page This commit moves the graph data the user got at the end of the survey to the review answers section. Task-2991360 closes odoo/odoo#114130 Signed-off-by: Thibault Delavallee (tde) --- addons/survey/controllers/main.py | 4 ++-- addons/survey/views/survey_templates.xml | 12 ------------ addons/survey/views/survey_templates_print.xml | 12 ++++++++++++ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/addons/survey/controllers/main.py b/addons/survey/controllers/main.py index e15cddb88f3..cc275b64e9f 100644 --- a/addons/survey/controllers/main.py +++ b/addons/survey/controllers/main.py @@ -204,8 +204,6 @@ class Survey(http.Controller): values = {'survey': survey, 'answer': answer} if token: values['token'] = token - if survey.scoring_type != 'no_scoring': - values['graph_data'] = json.dumps(answer._prepare_statistics()[answer]) return values # ------------------------------------------------------------ @@ -616,6 +614,8 @@ class Survey(http.Controller): 'scoring_display_correction': survey_sudo.scoring_type == 'scoring_with_answers' and answer_sudo, 'format_datetime': lambda dt: format_datetime(request.env, dt, dt_format=False), 'format_date': lambda date: format_date(request.env, date), + 'graph_data': json.dumps(answer_sudo._prepare_statistics()[answer_sudo]) + if answer_sudo and survey_sudo.scoring_type == 'scoring_with_answers' else False, }) @http.route('/survey//certification_preview', type="http", auth="user", website=True) diff --git a/addons/survey/views/survey_templates.xml b/addons/survey/views/survey_templates.xml index cd941377caf..267af1065d0 100644 --- a/addons/survey/views/survey_templates.xml +++ b/addons/survey/views/survey_templates.xml @@ -296,18 +296,6 @@ -
-
- -
-
- -
-
diff --git a/addons/survey/views/survey_templates_print.xml b/addons/survey/views/survey_templates_print.xml index ede6f44df29..01c619b2c07 100644 --- a/addons/survey/views/survey_templates_print.xml +++ b/addons/survey/views/survey_templates_print.xml @@ -13,6 +13,18 @@
+
+
+ +
+
+ +
+