[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) <tde@openerp.com>
This commit is contained in:
Patrick Hoste
2023-03-28 13:43:20 +02:00
parent 54ffd01b07
commit 14b7eff7c2
3 changed files with 14 additions and 14 deletions
+2 -2
View File
@@ -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/<model("survey.survey"):survey>/certification_preview', type="http", auth="user", website=True)
-12
View File
@@ -296,18 +296,6 @@
</div>
</div>
</div>
<div class="o_survey_result p-4 col-12 row" t-if="graph_data">
<div t-if="survey.page_ids" class="survey_graph col-lg-6 d-none d-md-block"
data-graph-type="by_section"
t-att-data-graph-data="graph_data">
<canvas id="by_section_chart"></canvas>
</div>
<div t-attf-class="survey_graph col-lg-6 #{'offset-lg-3' if not survey.page_ids else ''}"
data-graph-type="doughnut"
t-att-data-graph-data="graph_data">
<canvas id="doughnut_chart"></canvas>
</div>
</div>
</div>
</template>
@@ -13,6 +13,18 @@
<t t-if="survey.description"><div t-field='survey.description' class="oe_no_empty text-break"/></t>
<t t-if="review" t-call="survey.survey_button_retake"/>
</div>
<div t-if="graph_data" class="o_survey_result p-4 col-12 row">
<div t-if="survey.page_ids" class="survey_graph col-lg-6 d-none d-md-block"
data-graph-type="by_section"
t-att-data-graph-data="graph_data">
<canvas id="by_section_chart"></canvas>
</div>
<div t-attf-class="survey_graph col-lg-6 #{'offset-lg-3' if not survey.page_ids else ''}"
data-graph-type="doughnut"
t-att-data-graph-data="graph_data">
<canvas id="doughnut_chart"></canvas>
</div>
</div>
<div role="form">
<fieldset disabled="disabled">
<t t-set="question" t-value="False" />