TODO: add next_bill_date check on active subscription next April

This commit is contained in:
Son NK 2020-03-08 11:36:09 +01:00
parent b86937c5c7
commit 84f3d7c278
1 changed files with 4 additions and 0 deletions

View File

@ -297,6 +297,10 @@ class User(db.Model, ModelMixin, UserMixin):
TODO: support user unsubscribe and re-subscribe
"""
sub = Subscription.get_by(user_id=self.id)
# TODO: sub is active only if sub.next_bill_date > now
# due to a bug on next_bill_date, wait until next month (April 8)
# when all next_bill_date are correctly updated to add this check
if sub and sub.cancelled:
# sub is active until the next billing_date + 1
if sub.next_bill_date >= arrow.now().shift(days=-1).date():