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 5656
5757async def alert_consultant (context ):
5858 """Randomly alert consultant about important stuff to do"""
59- if outside_business_hours ():
59+ if await outside_business_hours ():
6060 return
6161
6262 consultants = await get_consultants ()
@@ -89,7 +89,7 @@ async def alert_consultant(context):
8989
9090async def call_for_timesheet (context ):
9191 """If needed, remind people to declare timesheet of current day"""
92- if outside_business_hours ():
92+ if await outside_business_hours ():
9393 return
9494 msg = _ ("""Hope the day was fine. Time to declare your timesheet no? Just click /time""" )
9595
Original file line number Diff line number Diff line change @@ -44,11 +44,12 @@ async def check_user_is_declared(update, context):
4444 return None
4545
4646
47+ @db_sync_to_async
4748def outside_business_hours ():
4849 """Don't bother people outside business hours"""
4950 now = datetime .now ()
5051 today = date .today ()
51- holiday_today = Holiday .objects .filter (day__contains = today )
52+ holiday_today = Holiday .objects .filter (day = today )
5253 return now .weekday () in (5 , 6 ) or now .hour < 9 or now .hour > 19 or holiday_today .count () > 0
5354
5455
You can’t perform that action at this time.
0 commit comments