diff options
| author | rar-odoo <rar@odoo.com> | 2017-08-17 16:30:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-17 16:30:48 +0200 |
| commit | 7e24143b352161dbd3fd3bfbc36a8ee23737e16c (patch) | |
| tree | 74cbb84da87df574891e903050fc4ccc0d14531a /addons/gamification/models | |
| parent | cd0ba4234bfa8ce3156d71f823d29d53b763a418 (diff) | |
[FIX] gamification: challenge winner (#18901)
In the curent behaviour, the users of the challenge are ordered
regardless of the goal definition (higher wins or lower wins).
This impacts the report email with the podium of users and always puts higher on top.
This fix changes the ordering depending on the goal definition type.
Diffstat (limited to 'addons/gamification/models')
| -rw-r--r-- | addons/gamification/models/challenge.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py index 8a1b02d65fe..22d5564df34 100644 --- a/addons/gamification/models/challenge.py +++ b/addons/gamification/models/challenge.py @@ -503,8 +503,12 @@ class Challenge(models.Model): line_data['own_goal_id'] = False, line_data['goals'] = [] - - goals = Goals.search(domain, order="completeness desc, current desc") + if line.condition=='higher': + goals = Goals.search(domain, order="completeness desc, current desc") + else: + goals = Goals.search(domain, order="completeness desc, current asc") + import ipdb + ipdb.set_trace() for ranking, goal in enumerate(goals): if user and goal.user_id == user: line_data['own_goal_id'] = goal.id |
