File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 56
56
57
57
async def alert_consultant (context ):
58
58
"""Randomly alert consultant about important stuff to do"""
59
- if outside_business_hours ():
59
+ if await outside_business_hours ():
60
60
return
61
61
62
62
consultants = await get_consultants ()
@@ -89,7 +89,7 @@ async def alert_consultant(context):
89
89
90
90
async def call_for_timesheet (context ):
91
91
"""If needed, remind people to declare timesheet of current day"""
92
- if outside_business_hours ():
92
+ if await outside_business_hours ():
93
93
return
94
94
msg = _ ("""Hope the day was fine. Time to declare your timesheet no? Just click /time""" )
95
95
Original file line number Diff line number Diff line change @@ -44,11 +44,12 @@ async def check_user_is_declared(update, context):
44
44
return None
45
45
46
46
47
+ @db_sync_to_async
47
48
def outside_business_hours ():
48
49
"""Don't bother people outside business hours"""
49
50
now = datetime .now ()
50
51
today = date .today ()
51
- holiday_today = Holiday .objects .filter (day__contains = today )
52
+ holiday_today = Holiday .objects .filter (day = today )
52
53
return now .weekday () in (5 , 6 ) or now .hour < 9 or now .hour > 19 or holiday_today .count () > 0
53
54
54
55
You can’t perform that action at this time.
0 commit comments