Fix default param in working hours utility
This commit is contained in:
parent
f26054fa9d
commit
8fc12c3759
@ -1,6 +1,9 @@
|
|||||||
from datetime import time, datetime, timedelta
|
from datetime import time, datetime, timedelta
|
||||||
|
|
||||||
def is_working_hours(date = datetime.now()):
|
def is_working_hours(date = None):
|
||||||
|
if not date:
|
||||||
|
date = datetime.now()
|
||||||
|
|
||||||
if date.weekday() >= 5:
|
if date.weekday() >= 5:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -10,7 +13,10 @@ def is_working_hours(date = datetime.now()):
|
|||||||
current_time = date.time()
|
current_time = date.time()
|
||||||
return start <= current_time <= end
|
return start <= current_time <= end
|
||||||
|
|
||||||
def potential_midday_upload(date = datetime.now()):
|
def potential_midday_upload(date = None):
|
||||||
|
if not date:
|
||||||
|
date = datetime.now()
|
||||||
|
|
||||||
if date.weekday() >= 5:
|
if date.weekday() >= 5:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -19,7 +25,10 @@ def potential_midday_upload(date = datetime.now()):
|
|||||||
current_time = date.time()
|
current_time = date.time()
|
||||||
return midday_upload_time <= current_time
|
return midday_upload_time <= current_time
|
||||||
|
|
||||||
def next_working_hour(date = datetime.now()):
|
def next_working_hour(date = None):
|
||||||
|
if not date:
|
||||||
|
date = datetime.now()
|
||||||
|
|
||||||
if is_working_hours(date):
|
if is_working_hours(date):
|
||||||
return date
|
return date
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user