Commit f20982f9 authored by MEESSEN Christophe's avatar MEESSEN Christophe
Browse files

add white lines in get_weekly_start_time for clarity

parent 1d03f509
......@@ -125,6 +125,7 @@ def get_weekly_start_time(scheduling):
params = m.groups()
if len(params) != 3:
return (None, 0, 'Scheduling "{}" is not valid'.format(scheduling))
weekday = params[0]
hour = int(params[1])
minute = int(params[2])
......@@ -134,13 +135,16 @@ def get_weekly_start_time(scheduling):
return (None, 0, 'Hour in "{}" is not valid'.format(scheduling))
if minute < 0 or minute >= 60:
return (None, 0, 'Minute in "{}" is not valid'.format(scheduling))
# Set day
days = weekday_id[weekday] - start_time.weekday()
start_time += timedelta(days=days)
# Set time
new_time = {'hour': hour, 'minute': minute,
'second': 0, 'microsecond': 0}
start_time = start_time.replace(**new_time)
# Add n periods until start is in the future
while start_time < datetime.datetime.now():
start_time += timedelta(seconds=period)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment