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:
Yared Yemane 2026-08-16 19:42:54 +03:00
parent 135c2bd5ce
commit 0eef38b9a3
2 changed files with 0 additions and 8 deletions

View File

@ -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'

View File

@ -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'