fix: Add logic to filter active subscriptions in check_if_is_premium_user function (#2673)

# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):

Co-authored-by: Stan Girard <stan@quivr.app>
This commit is contained in:
Stan Girard 2024-06-13 22:45:01 +02:00 committed by GitHub
parent 7b3d5d81dd
commit f546fd4d54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -199,6 +199,16 @@ def check_if_is_premium_user():
)
.execute()
).data
# Only get the subscriptions with status active
logger.info(f"Subscriptions: {subscriptions}")
if len(subscriptions) > 0:
subscriptions = [
subscription
for subscription in subscriptions
if subscription["attrs"]["status"] == "active"
]
else:
logger.info(f"No active subscriptions found")
# Get List of all customers
customers = (