From 9d1b07f97b85e18c7d6386ccab47d778a8219bfd Mon Sep 17 00:00:00 2001 From: Nans Lefebvre Date: Fri, 1 Feb 2019 08:07:56 +0000 Subject: [FIX] project, rating: use rating last update to compute satisfaction percentage The function _compute_parent_rating_percentage_satisfaction used the creation date of the rating to compute the percentage. However when a client give a new rating, it updates the old one. As a result it doesn't give the recent satisfaction percentage, but the satisfaction percentage of recently created tickets. In other words recently angry clients from old projects would not appear. Similarly this method is somewhat reimplemented directly in SQL in the rating route, which happens to be in the project controller. opw 1921486 closes odoo/odoo#30752 --- addons/project/controllers/rating.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'addons/project/controllers') diff --git a/addons/project/controllers/rating.py b/addons/project/controllers/rating.py index 4e800fbafb3..c89f186a6ce 100644 --- a/addons/project/controllers/rating.py +++ b/addons/project/controllers/rating.py @@ -23,10 +23,10 @@ class RatingProject(http.Controller): rating, COUNT(rating) as rating_count, CASE - WHEN now()::date - create_date::date BETWEEN 0 AND 6 Then 'days_06' - WHEN now()::date - create_date::date BETWEEN 0 AND 15 Then 'days_15' - WHEN now()::date - create_date::date BETWEEN 0 AND 30 Then 'days_30' - WHEN now()::date - create_date::date BETWEEN 0 AND 90 Then 'days_90' + WHEN now()::date - write_date::date BETWEEN 0 AND 6 Then 'days_06' + WHEN now()::date - write_date::date BETWEEN 0 AND 15 Then 'days_15' + WHEN now()::date - write_date::date BETWEEN 0 AND 30 Then 'days_30' + WHEN now()::date - write_date::date BETWEEN 0 AND 90 Then 'days_90' END AS period FROM rating_rating @@ -35,7 +35,7 @@ class RatingProject(http.Controller): AND parent_res_id = %s AND res_model = 'project.task' AND rated_partner_id IS NOT NULL - AND create_date >= current_date - interval '90' day + AND write_date >= current_date - interval '90' day AND rating IN (1,5,10) GROUP BY rated_partner_id, rating, period -- cgit v1.2.3