[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
This commit is contained in:
Goffin Simon 2015-04-03 10:10:53 +02:00
parent 8121f29848
commit b1dd5d6045
1 changed files with 5 additions and 4 deletions

View File

@ -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