From 717377eb437dce37a0161a3f9d05a62c985689c9 Mon Sep 17 00:00:00 2001 From: Matt Lott Date: Tue, 10 Nov 2015 14:54:39 -0800 Subject: [PATCH] Update analytics aggregation script Giving preference to payments created field over _id date. --- .../analytics/mongodb/queries/insertPerDayAnalytics.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/analytics/mongodb/queries/insertPerDayAnalytics.js b/scripts/analytics/mongodb/queries/insertPerDayAnalytics.js index 913709a17..f154e4805 100644 --- a/scripts/analytics/mongodb/queries/insertPerDayAnalytics.js +++ b/scripts/analytics/mongodb/queries/insertPerDayAnalytics.js @@ -642,7 +642,13 @@ function getRecurringRevenueCounts(startDay) { var cursor = db.payments.find({_id: {$gte: startObj}}); while (cursor.hasNext()) { var doc = cursor.next(); - var day = doc._id.getTimestamp().toISOString().substring(0, 10); + var day; + if (doc.created) { + day = doc.created.substring(0, 10); + } + else { + day = doc._id.getTimestamp().toISOString().substring(0, 10); + } if (doc.service === 'ios' || doc.service === 'bitcoin') continue;