From fed533bcf2385382d3f1fbf9af7ead3abaa53dc5 Mon Sep 17 00:00:00 2001 From: David Beguin Date: Mon, 30 Sep 2019 13:37:35 +0000 Subject: [PATCH] [FIX] livechat : fix rating per user in livechat frontend view rating_per_user was instanciated the wrong way, as all the key pointed to the same reference. Once a value was modified in the value dict, all the other values in rating_per_user were also updated. Task ID: 2076656 PR #37511 Signed-off-by: Thibault Delavallee (tde) --- addons/website_livechat/controllers/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/website_livechat/controllers/main.py b/addons/website_livechat/controllers/main.py index 9fb4678d39e..f6a5b90fc0c 100644 --- a/addons/website_livechat/controllers/main.py +++ b/addons/website_livechat/controllers/main.py @@ -33,7 +33,8 @@ class WebsiteLivechat(http.Controller): percentage[grade] = round(repartition[grade] * 100.0 / sum(repartition.values()), 1) if sum(repartition.values()) else 0 # filter only on the team users that worked on the last 100 ratings and get their detailed stat - ratings_per_partner = dict.fromkeys(ratings.mapped('rated_partner_id.id'), dict.fromkeys(['great', 'okay', 'bad'], 0)) + ratings_per_partner = {partner_id: dict(great=0, okay=0, bad=0) + for partner_id in ratings.mapped('rated_partner_id.id')} total_ratings_per_partner = dict.fromkeys(ratings.mapped('rated_partner_id.id'), 0) rating_texts = {10: 'great', 5: 'okay', 1: 'bad'}