[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
This commit is contained in:
Martin Trigaux
2019-08-26 09:41:36 +00:00
parent 15084109ef
commit 64fef75eef
+2 -2
View File
@@ -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