[FIX] survey: only show attendees ranking when relevant

The computed field 'session_show_ranking' was only computed based on the fact
that the survey had a scoring mechanism.

It's not very accurate since we also need a question that saves as the attendee
nickname to be able to display a relevant ranking chart.

This commit fixes the compute method by adding the necessary condition.

Task ID 2188482

closes odoo/odoo#45852

X-original-commit: 86ca11517d3872b2bf3cf89eda513a3bc8c84292
Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
This commit is contained in:
Aurélien Warnon
2020-02-20 16:20:49 +00:00
parent caa09423e0
commit aaa7cfa535
+3 -2
View File
@@ -193,10 +193,11 @@ class Survey(models.Model):
survey.session_question_answer_count = answer_count
@api.depends('scoring_type')
@api.depends('scoring_type', 'question_and_page_ids.save_as_nickname')
def _compute_session_show_ranking(self):
for survey in self:
survey.session_show_ranking = survey.scoring_type != 'no_scoring'
survey.session_show_ranking = survey.scoring_type != 'no_scoring' and \
any(question.save_as_nickname for question in survey.question_and_page_ids)
@api.onchange('scoring_success_min')
def _onchange_scoring_success_min(self):