Skip to content

Commit

Permalink
Don't send mail to warn user to fill timesheet if current day is week…
Browse files Browse the repository at this point in the history
…end and holiday
  • Loading branch information
bport committed Feb 23, 2025
1 parent 203991e commit bc814bf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion staffing/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@license: AGPL v3 or newer (http://www.gnu.org/licenses/agpl-3.0.html)
"""

from datetime import date, timedelta
from datetime import date, timedelta, datetime
from celery import shared_task

from django.urls import reverse
Expand All @@ -16,6 +16,7 @@

from core.utils import get_parameter
from people.models import Consultant
from staffing.models import Holiday
from staffing.utils import gatherTimesheetData


Expand All @@ -25,6 +26,12 @@ def warn_for_incomplete_timesheet(warn_overbooking=False, days=None, month="last
:param warn_overbooking: Warn for overbooking days (default is false)
:param days: only check n first days. If None (default), check all month
:param month: Month to check: current or last (default) month"""

# Don't send mail weekend or holiday
today = datetime.today()
if today.weekday() in (5, 6) or Holiday.objects.filter(day=today).exists():
return

email_template = get_template("batch/timesheet_warning_email.txt")
if month == "current":
#TODO use core.utils nextMonth()
Expand Down

0 comments on commit bc814bf

Please sign in to comment.