diff options
| author | Martin Trigaux <mat@odoo.com> | 2019-08-23 14:06:18 +0000 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2019-08-26 10:03:54 +0000 |
| commit | 6ca81cd8685f4152173eaaadfb1941d905ad2b8f (patch) | |
| tree | 9b2f9dd69b5c04ef66f9bbd2b2156edcf1058c4b /addons/gamification/models/challenge.py | |
| parent | 712808581dfb1ac31930ca0147a970d2b74ca36d (diff) | |
[FIX] gamification: tolerate invalid definitions
If a goal definition with a target goal of 0 and "higher the better",
instead of dividing by 0, set a progress of 0% (it is not possible to
compute the progress)
Task id: 2057898
Diffstat (limited to 'addons/gamification/models/challenge.py')
| -rw-r--r-- | addons/gamification/models/challenge.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py index 381b78f6693..ae51158290c 100644 --- a/addons/gamification/models/challenge.py +++ b/addons/gamification/models/challenge.py @@ -743,7 +743,7 @@ class Challenge(models.Model): all_reached = False if goal.definition_condition == 'higher': # can be over 100 - total_completeness += 100.0 * goal.current / goal.target_goal + total_completeness += (100.0 * goal.current / goal.target_goal) if goal.target_goal else 0 elif goal.state == 'reached': # for lower goals, can not get percentage so 0 or 100 total_completeness += 100 |
