From e4bec95b4e77b7641d19ad51c035d36e44a566dc Mon Sep 17 00:00:00 2001 From: Son NK Date: Wed, 5 Feb 2020 21:21:56 +0700 Subject: [PATCH] do not send trial ending soon or onboarding to unactivated user --- cron.py | 4 +++- job_runner.py | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cron.py b/cron.py index dd61bbad..7962c45b 100644 --- a/cron.py +++ b/cron.py @@ -19,7 +19,9 @@ from server import create_app def notify_trial_end(): - for user in User.query.filter(User.trial_end.isnot(None)).all(): + for user in User.query.filter( + User.activated == True, User.trial_end.isnot(None) + ).all(): if arrow.now().shift(days=3) > user.trial_end >= arrow.now().shift(days=2): LOG.d("Send trial end email to user %s", user) send_trial_end_soon_email(user) diff --git a/job_runner.py b/job_runner.py index 0c412112..be099941 100644 --- a/job_runner.py +++ b/job_runner.py @@ -37,6 +37,10 @@ def new_app(): def onboarding_1(user): + if not user.activated: + LOG.d("User %s is not activated", user) + return + if not user.notification: LOG.d("User %s disable notification setting", user) return