Skip to content

Commit

Permalink
Merge branch 'master' into enhancement/view-edit-search-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 authored Oct 6, 2023
2 parents f73ac2d + f6a579f commit 97af3c1
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
18 changes: 16 additions & 2 deletions requirements-base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ blis==0.7.10
# via thinc
blockkit==1.5.2
# via -r requirements-base.in
boto3==1.28.59
# via -r requirements-base.in
botocore==1.31.59
# via
# boto3
# s3transfer
cachetools==5.3.1
# via
# -r requirements-base.in
Expand Down Expand Up @@ -106,7 +112,7 @@ deprecation==2.1.0
# via pdpyras
dnspython==2.4.2
# via email-validator
duo-client==5.0.1
duo-client==5.1.0
# via -r requirements-base.in
ecdsa==0.18.0
# via python-jose
Expand Down Expand Up @@ -180,6 +186,10 @@ jinja2==3.1.2
# spacy
jira==2.0.0
# via -r requirements-base.in
jmespath==1.0.1
# via
# boto3
# botocore
joblib==1.3.2
# via -r requirements-base.in
jsonpath-ng==1.6.0
Expand Down Expand Up @@ -315,6 +325,7 @@ pytest-subtests==0.7.0
python-dateutil==2.8.2
# via
# -r requirements-base.in
# botocore
# emails
# pandas
python-jose==3.3.0
Expand Down Expand Up @@ -358,6 +369,8 @@ rsa==4.9
# google-auth
# oauth2client
# python-jose
s3transfer==0.7.0
# via boto3
schedule==1.2.1
# via -r requirements-base.in
schemathesis==3.19.7
Expand Down Expand Up @@ -388,7 +401,7 @@ six==1.16.0
# validators
slack-bolt==1.18.0
# via -r requirements-base.in
slack-sdk==3.22.0
slack-sdk==3.23.0
# via
# -r requirements-base.in
# slack-bolt
Expand Down Expand Up @@ -469,6 +482,7 @@ uritemplate==4.1.1
# via google-api-python-client
urllib3==1.26.16
# via
# botocore
# google-auth
# pdpyras
# requests
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ click==8.1.7
# via
# -r requirements-dev.in
# black
coverage==7.3.1
coverage==7.3.2
# via -r requirements-dev.in
decorator==5.1.1
# via ipython
Expand Down Expand Up @@ -90,7 +90,7 @@ python-dateutil==2.8.2
# via faker
pyyaml==6.0.1
# via pre-commit
ruff==0.0.291
ruff==0.0.292
# via -r requirements-dev.in
six==1.16.0
# via
Expand Down
21 changes: 15 additions & 6 deletions src/dispatch/case/scheduled.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import logging

from datetime import datetime, date
from schedule import every

Expand All @@ -13,6 +15,9 @@
)


log = logging.getLogger(__name__)


@scheduler.add(every(1).day.at("18:00"), name="case-close-reminder")
@timer
@scheduled_project_task
Expand All @@ -23,12 +28,16 @@ def case_close_reminder(db_session: SessionLocal, project: Project):
)

for case in cases:
span = datetime.utcnow() - case.triage_at
q, r = divmod(span.days, 7)
if q >= 1 and date.today().isoweekday() == 1:
# we only send the reminder for cases that have been triaging
# longer than a week and only on Mondays
send_case_close_reminder(case, db_session)
try:
span = datetime.utcnow() - case.triage_at
q, r = divmod(span.days, 7)
if q >= 1 and date.today().isoweekday() == 1:
# we only send the reminder for cases that have been triaging
# longer than a week and only on Mondays
send_case_close_reminder(case, db_session)
except Exception as e:
# if one fails we don't want all to fail
log.exception(e)


@scheduler.add(every(1).day.at("18:00"), name="case-triage-reminder")
Expand Down

0 comments on commit 97af3c1

Please sign in to comment.