Broaden Unsubscribed user filter to include pending and expired subscriptions.
Users without an active subscription now match Unsubscribed, covering pending payments and lapsed plans alongside never-subscribed learners. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
135c2bd5ce
commit
0eef38b9a3
|
|
@ -409,10 +409,6 @@ WHERE
|
|||
AND us.status = 'ACTIVE'
|
||||
AND us.expires_at > CURRENT_TIMESTAMP
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM user_subscriptions us
|
||||
WHERE us.user_id = users.id AND us.status = 'PENDING'
|
||||
)
|
||||
)
|
||||
OR (
|
||||
sqlc.narg('subscription_status')::TEXT = 'EXPIRED'
|
||||
|
|
|
|||
|
|
@ -711,10 +711,6 @@ WHERE
|
|||
AND us.status = 'ACTIVE'
|
||||
AND us.expires_at > CURRENT_TIMESTAMP
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM user_subscriptions us
|
||||
WHERE us.user_id = users.id AND us.status = 'PENDING'
|
||||
)
|
||||
)
|
||||
OR (
|
||||
$31::TEXT = 'EXPIRED'
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user