Skip to content

Commit

Permalink
- test code for sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
elipe17 committed May 31, 2023
1 parent e6d9b81 commit 0603774
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions tdrs-backend/tdpservice/scheduling/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ def check_for_accounts_needing_deactivation_warning():
deactivate_in_3_days = users_to_deactivate(3)
deactivate_in_1_day = users_to_deactivate(1)

if deactivate_in_10_days:
send_deactivation_warning_email(deactivate_in_10_days, 10)
if deactivate_in_3_days:
send_deactivation_warning_email(deactivate_in_3_days, 3)
if deactivate_in_1_day:
send_deactivation_warning_email(deactivate_in_1_day, 1)
# if deactivate_in_10_days:
send_deactivation_warning_email(deactivate_in_10_days, 10)
# if deactivate_in_3_days:
# send_deactivation_warning_email(deactivate_in_3_days, 3)
# if deactivate_in_1_day:
# send_deactivation_warning_email(deactivate_in_1_day, 1)

def users_to_deactivate(days):
"""Return a list of users that have not logged in in the last {180 - days} days."""
days = 180 - days
return User.objects.filter(
last_login__lte=datetime.now(tz=timezone.utc) - timedelta(days=days),
last_login__gte=datetime.now(tz=timezone.utc) - timedelta(days=days+1),
# last_login__lte=datetime.now(tz=timezone.utc) - timedelta(days=days),
# last_login__gte=datetime.now(tz=timezone.utc) - timedelta(days=days+1),
account_approval_status=AccountApprovalStatusChoices.APPROVED,
)

Expand Down
2 changes: 1 addition & 1 deletion tdrs-backend/tdpservice/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ class Common(Configuration):
},
'name': {
'task': 'tdpservice.scheduling.tasks.check_for_accounts_needing_deactivation_warning',
'schedule': crontab(day_of_week='*', hour='13', minute='0'), # Every day at 1pm UTC (9am EST)
'schedule': crontab(day_of_week='*', hour='*', minute='*'), # Every day at 1pm UTC (9am EST)

'options': {
'expires': 15.0,
Expand Down

0 comments on commit 0603774

Please sign in to comment.