File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,9 @@ async def check_user_is_declared(update, context):
47
47
def outside_business_hours ():
48
48
"""Don't bother people outside business hours"""
49
49
now = datetime .now ()
50
- return now .weekday () in (5 , 6 ) or now .hour < 9 or now .hour > 19
50
+ today = date .today ()
51
+ holiday_today = Holiday .objects .filter (day__contains = today )
52
+ return now .weekday () in (5 , 6 ) or now .hour < 9 or now .hour > 19 or holiday_today .count () > 0
51
53
52
54
53
55
@db_sync_to_async
@@ -60,10 +62,6 @@ def get_consultants():
60
62
@db_sync_to_async
61
63
def time_to_declare (consultant ):
62
64
today = date .today ()
63
- holidays = Holiday .objects .all ()
64
- if today .weekday () < 5 and today not in holidays :
65
- declared = Timesheet .objects .filter (consultant = consultant , working_date = today ).aggregate (Sum ("charge" ))[
66
- "charge__sum" ] or 0
67
- return 1 - declared
68
- else :
69
- return 0
65
+ declared = Timesheet .objects .filter (consultant = consultant , working_date = today ).aggregate (Sum ("charge" ))[
66
+ "charge__sum" ] or 0
67
+ return 1 - declared
You can’t perform that action at this time.
0 commit comments