Update analytics aggregation script

Giving preference to payments created field over _id date.
This commit is contained in:
Matt Lott 2015-11-10 14:54:39 -08:00
parent e33323e7eb
commit 717377eb43

View file

@ -642,7 +642,13 @@ function getRecurringRevenueCounts(startDay) {
var cursor = db.payments.find({_id: {$gte: startObj}}); var cursor = db.payments.find({_id: {$gte: startObj}});
while (cursor.hasNext()) { while (cursor.hasNext()) {
var doc = cursor.next(); 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; if (doc.service === 'ios' || doc.service === 'bitcoin') continue;