do not send trial ending soon or onboarding to unactivated user

This commit is contained in:
Son NK 2020-02-05 21:21:56 +07:00
parent ccefca5e84
commit e4bec95b4e
2 changed files with 7 additions and 1 deletions

View File

@ -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)

View File

@ -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