From 08eff2b4894e9ad9874c3bc91877e890277b909b Mon Sep 17 00:00:00 2001 From: Matt Lott Date: Wed, 13 May 2015 16:09:27 -0700 Subject: [PATCH] :bug:Fix admin dashboard invoice sorting Bug was introduced by recent perf work. --- server/payments/subscription_handler.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/payments/subscription_handler.coffee b/server/payments/subscription_handler.coffee index abfa6ab72..03af49731 100644 --- a/server/payments/subscription_handler.coffee +++ b/server/payments/subscription_handler.coffee @@ -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