From b1dd5d60451b03199cff7e1edde61623c1fc5a2c Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Fri, 3 Apr 2015 10:10:53 +0200 Subject: [PATCH] [FIX] gamification: Start Date and End Date format In the function start_end_date_for_period, in the "else" clause, the case considered for the period is "once". In this case, start_date and end_date are either False or in string format. opw: 631941 --- addons/gamification/models/challenge.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py index ce0c86c5cf1..13171ce1814 100644 --- a/addons/gamification/models/challenge.py +++ b/addons/gamification/models/challenge.py @@ -36,7 +36,10 @@ MAX_VISIBILITY_RANKING = 3 def start_end_date_for_period(period, default_start_date=False, default_end_date=False): """Return the start and end date for a goal period based on today - :return: (start_date, end_date), datetime.date objects, False if the period is + :param str default_start_date: string date in DEFAULT_SERVER_DATE_FORMAT format + :param str default_end_date: string date in DEFAULT_SERVER_DATE_FORMAT format + + :return: (start_date, end_date), dates in string format, False if the period is not defined or unknown""" today = date.today() if period == 'daily': @@ -57,11 +60,9 @@ def start_end_date_for_period(period, default_start_date=False, default_end_date start_date = default_start_date # for manual goal, start each time end_date = default_end_date - if start_date and end_date: - return (datetime.strftime(start_date, DF), datetime.strftime(end_date, DF)) - else: return (start_date, end_date) + return (datetime.strftime(start_date, DF), datetime.strftime(end_date, DF)) class gamification_challenge(osv.Model): """Gamification challenge