New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Members with cancelled comp plans aren't listed with the free members filter #12160
Comments
The issue is that our "free member" query works on the assumption that members do not have a Stripe customer record if they are unpaid. We can adjust the generated SQL query to something like this: select
`members`.*
from
`members`
left join `members_stripe_customers` on `members`.`id` = `members_stripe_customers`.`member_id`
left join `members_stripe_customers_subscriptions` on `members_stripe_customers`.`customer_id` = `members_stripe_customers_subscriptions`.`customer_id`
where
`members_stripe_customers`.`member_id` is null
or `members_stripe_customers_subscriptions`.`customer_id` is null
or `members_stripe_customers_subscriptions`.`status` not in ("active", "trialed"); However that query involves fetching all members/customers/subscriptions no matter what limit is applied meaning performance isn't great. For ~100k members with subscriptions and 3 test members with no customer, no subscription, or subscription that isn't active or trialed the query takes ~1sec locally even for paged result sets. I'm not sure if there's a way to improve the query or if we'd need to look at a different way of fetching free members. We could possibly run multiple queries checking:
We'd need to re-architect how the |
Alternative quick-fix would be to ensure that stripe customer data is cleared from the database when a member has a complimentary plan removed or otherwise has their subscription cancelled. That would still leave us with a potentially brittle handling of |
Was having a look at this issue and think the last solution proposed: "ensure that stripe customer data is cleared from the database" is not a good option because we rely on the Given following:
Maybe the most performant and reliable method would be introducing an |
I'm seeing a discrepancy where a member who started a checkout but didn't go through with it (in other words, a Stripe |
refs TryGhost#12160 This flag will be used to determine if a member is free or paid, rather than relying on joins with the customers and subscriptions tables.
refs #12160 This flag will allow us easier filtering of members via the API * Added status column to members table This flag will be used to determine if a member is free or paid, rather than relying on joins with the customers and subscriptions tables. * Added migration to populate members.status As we add the column with a default value of "free" we only need to care about the paid members here. We also preemptively handle migrations for SQLite where there are > 998 paid members.
refs #12160 This flag will allow us easier filtering of members via the API * Added status column to members table This flag will be used to determine if a member is free or paid, rather than relying on joins with the customers and subscriptions tables. * Added migration to populate members.status As we add the column with a default value of "free" we only need to care about the paid members here. We also preemptively handle migrations for SQLite where there are > 998 paid members.
refs TryGhost#12160 This flag will allow us easier filtering of members via the API * Added status column to members table This flag will be used to determine if a member is free or paid, rather than relying on joins with the customers and subscriptions tables. * Added migration to populate members.status As we add the column with a default value of "free" we only need to care about the paid members here. We also preemptively handle migrations for SQLite where there are > 998 paid members.
Issue Summary
Members who have had complimentary plans removed don't appear in the free members filter on the members list.
To Reproduce
/ghost/#/members?paid=false
)/ghost/#/members?paid=true
)What did you expect to happen instead?
Member should be reverted to a free member, and appear in the free members filtered list.
We should also verify the behaviour for cancelled and expired paid members (they should also appear as free members).
Technical details:
The text was updated successfully, but these errors were encountered: