From 3691ee0ca7fef54715aed545bbeacb12adec627e Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 9 May 2014 15:18:39 +0200 Subject: [PATCH] [FIX] gamification: avoid challenge to be initialised at the target limit (e.g. set your company data goal has a target of 0) and make sure we will compute the goal at least once bzr revid: mat@openerp.com-20140509131839-lm5zt696sif1krvx --- addons/gamification/data/goal_base.xml | 2 +- addons/gamification/models/challenge.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/addons/gamification/data/goal_base.xml b/addons/gamification/data/goal_base.xml index 1c18a5a..93ca8af 100644 --- a/addons/gamification/data/goal_base.xml +++ b/addons/gamification/data/goal_base.xml @@ -110,7 +110,7 @@ count boolean - [('user_ids', 'in', [user.id]), ('name', '=', 'Your Company')] + [('user_ids', 'in', [user.id]), ('name', '=', 'YourCompany')] lower user.company_id.id diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py index b532232..8ed3890 100644 --- a/addons/gamification/models/challenge.py +++ b/addons/gamification/models/challenge.py @@ -422,6 +422,12 @@ class gamification_challenge(osv.Model): if end_date: values['end_date'] = end_date + # 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 + else: + values['current'] = line.target_goal + 1 + if challenge.remind_update_delay: values['remind_update_delay'] = challenge.remind_update_delay -- 1.7.10.4