From 64fef75eef136812d365ea60ef41b76cac87e6b4 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 23 Aug 2019 13:25:50 +0000 Subject: [PATCH] [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 --- addons/gamification/models/challenge.py | 4 ++-- 1 file 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