diff options
| author | Nans Lefebvre <len@odoo.com> | 2019-02-01 08:07:56 +0000 |
|---|---|---|
| committer | Nans Lefebvre <len@odoo.com> | 2019-02-01 09:01:27 +0000 |
| commit | 9d1b07f97b85e18c7d6386ccab47d778a8219bfd (patch) | |
| tree | f356539a0f1763f211606d73330315242e29e603 /addons/project/controllers | |
| parent | 220644785cae566af4ac7e5b8df331e7d16696db (diff) | |
[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
Diffstat (limited to 'addons/project/controllers')
| -rw-r--r-- | addons/project/controllers/rating.py | 10 |
1 files changed, 5 insertions, 5 deletions
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 |
