mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01:00
Add a None check before doing a DT comparison when getting subscription type
This commit is contained in:
parent
0f6f282c30
commit
b257fa1884
1 changed files with 1 additions and 1 deletions
|
@ -301,7 +301,7 @@ def subscription_to_state(subscription: Subscription) -> str:
|
||||||
return SubscriptionState.INVALID.value
|
return SubscriptionState.INVALID.value
|
||||||
elif subscription.type == Subscription.Type.TRIAL:
|
elif subscription.type == Subscription.Type.TRIAL:
|
||||||
# Check if the trial has expired
|
# Check if the trial has expired
|
||||||
if datetime.now(tz=timezone.utc) > subscription.renewal_date:
|
if subscription.renewal_date and datetime.now(tz=timezone.utc) > subscription.renewal_date:
|
||||||
return SubscriptionState.EXPIRED.value
|
return SubscriptionState.EXPIRED.value
|
||||||
return SubscriptionState.TRIAL.value
|
return SubscriptionState.TRIAL.value
|
||||||
elif subscription.is_recurring and subscription.renewal_date > datetime.now(tz=timezone.utc):
|
elif subscription.is_recurring and subscription.renewal_date > datetime.now(tz=timezone.utc):
|
||||||
|
|
Loading…
Reference in a new issue