summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2019-08-23 13:25:50 +0000
committerMartin Trigaux <mat@odoo.com>2019-08-26 09:41:36 +0000
commit64fef75eef136812d365ea60ef41b76cac87e6b4 (patch)
treeb0059d330e773a7b52005591554e5d41921233bc
parent15084109ef08acd1898fccf5967636389590ec0e (diff)
[FIX] gamification: initialize goals at 0
If a manual goal has a target of 10, it should not start at 9 but 0 If it has a target of 0, it should start at -1 Task id: 2057898
-rw-r--r--addons/gamification/models/challenge.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py
index 345e06e34da..381b78f6693 100644
--- a/addons/gamification/models/challenge.py
+++ b/addons/gamification/models/challenge.py
@@ -383,9 +383,9 @@ class Challenge(models.Model):
# the goal is initialised over the limit to make sure we will compute it at least once
if line.condition == 'higher':
- values['current'] = line.target_goal - 1
+ values['current'] = min(line.target_goal - 1, 0)
else:
- values['current'] = line.target_goal + 1
+ values['current'] = max(line.target_goal + 1, 0)
if challenge.remind_update_delay:
values['remind_update_delay'] = challenge.remind_update_delay