mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 15:38:55 +01:00
Merge branch 'master' of github.com:khoj-ai/khoj into features/advanced-reasoning
This commit is contained in:
commit
82f3d79064
1 changed files with 5 additions and 0 deletions
|
@ -301,6 +301,11 @@ def subscription_to_state(subscription: Subscription) -> str:
|
|||
return SubscriptionState.INVALID.value
|
||||
elif subscription.type == Subscription.Type.TRIAL:
|
||||
# Check if the trial has expired
|
||||
if not subscription.renewal_date:
|
||||
# If the renewal date is not set, set it to the current date + trial length and evaluate
|
||||
subscription.renewal_date = subscription.created_at + timedelta(days=LENGTH_OF_FREE_TRIAL)
|
||||
subscription.save()
|
||||
|
||||
if subscription.renewal_date and datetime.now(tz=timezone.utc) > subscription.renewal_date:
|
||||
return SubscriptionState.EXPIRED.value
|
||||
return SubscriptionState.TRIAL.value
|
||||
|
|
Loading…
Reference in a new issue