🐛Fix admin dashboard invoice sorting

Bug was introduced by recent perf work.
This commit is contained in:
Matt Lott 2015-05-13 16:09:27 -07:00
parent dc4437e9f5
commit 08eff2b489

View file

@ -177,7 +177,9 @@ class SubscriptionHandler extends Handler
processInvoices null, (err) =>
return @sendDatabaseError(res, err) if err
subMap = {}
for invoiceID, invoice of @invoices
invoices = (invoice for invoiceID, invoice of @invoices)
invoices.sort (a, b) -> if a.date > b.date then -1 else 1
for invoice in invoices
subID = invoice.subscriptionID
if subID of subMap
subMap[subID].first = invoice.date