🐛Admin dashboard deleted users

Also disabling invoice caching to see if that is what causes invalid
sub end counts.
This commit is contained in:
Matt Lott 2015-05-11 10:37:30 -07:00
parent 5a50e36a10
commit 6dc51e27e4
2 changed files with 8 additions and 9 deletions

View file

@ -68,11 +68,14 @@ block content
if subscriber.cancel
span= subscriber.cancel.substring(0, 10)
td
if subscriber.user.stripe.sponsorID
if subscriber.user.stripe && subscriber.user.stripe.sponsorID
span *sponsored*
else if subscriber.user.conversion
span= subscriber.user.conversion
td= subscriber.user.emailLower
if subscriber.user.deleted
td DELETED
else
td= subscriber.user.emailLower
td= subscriber.hero
td= subscriber.level
td= subscriber.user.ageRange

View file

@ -146,7 +146,9 @@ class SubscriptionHandler extends Handler
return @sendForbiddenError(res) unless req.user?.isAdmin()
@invoices ?= [] # Keep sorted newest to oldest
# TODO: disabling caching to investigate sub end counts bug
# @invoices ?= [] # Keep sorted newest to oldest
@invoices = []
newInvoices = []
processInvoices = (starting_after, done) =>
@ -176,13 +178,7 @@ class SubscriptionHandler extends Handler
processInvoices null, (err) =>
return @sendDatabaseError(res, err) if err
@invoices = newInvoices.concat(@invoices)
# TODO: Temporarily debugging elevated sub end counts in production over time
debugInvoiceCount = @invoices.length
@invoices = _.uniq @invoices, false, 'invoiceID'
if debugInvoiceCount isnt @invoices.length
log.debug "Analytics cached @invoices had duplicates: #{debugInvoiceCount} #{@invoices.length}"
subMap = {}
for invoice in @invoices
subID = invoice.subscriptionID