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):
4747def outside_business_hours ():
4848 """Don't bother people outside business hours"""
4949 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
5153
5254
5355@db_sync_to_async
@@ -60,10 +62,6 @@ def get_consultants():
6062@db_sync_to_async
6163def time_to_declare (consultant ):
6264 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