[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) <tde@openerp.com>
This commit is contained in:
David Beguin
2019-09-30 15:54:51 +00:00
parent c7d6fc84a8
commit fed533bcf2
+2 -1
View File
@@ -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'}