Fix subscription revenue widget — pro-rata allocation from invoice items
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>
Showing
This diff is collapsed.
Please register or sign in to comment