From 4ad44dbcdf6e40f16491597bd7fe5e23aa19540f Mon Sep 17 00:00:00 2001 From: Son NK Date: Sat, 15 Feb 2020 16:29:44 +0700 Subject: [PATCH] only send trial-end email to user who is in trial i.e. users who: 1. has lifetime licence or active subscription and 2. is in trial period --- cron.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cron.py b/cron.py index 7468bfeb..c7e0175f 100644 --- a/cron.py +++ b/cron.py @@ -22,7 +22,9 @@ def notify_trial_end(): for user in User.query.filter( User.activated == True, User.trial_end.isnot(None), User.lifetime == False ).all(): - if arrow.now().shift(days=3) > user.trial_end >= arrow.now().shift(days=2): + if user.in_trial() and 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)