-
Mahmoud Aglan authored
The old query only found 30 enrollments (those with invoice_id set) and showed 33K (9.3%). The correct approach identifies subscription line items via invoice_items.itemable_type IS NULL (218 items), then pro-rates each payment by the subscription portion of that invoice's total. Result: 174K (48.5%) which matches actual subscription collections including bundled invoices and installment payments. Co-Authored-By:Claude Opus 4.6 <noreply@anthropic.com>
805bfc36