fix(plans): when gifting subscription, set plan.dateUpdated so it can

roll gemCapExtra next month. Fixes #4480
This commit is contained in:
Tyler Renelle
2015-01-07 14:58:58 -07:00
parent c96ae618db
commit 0b28f6df55
2 changed files with 6 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
db.users.update(
{'purchased.plan.customerId':{$ne:null}, 'purchased.plan.dateUpdated':null},
{$set: {'purchased.plan.datedUpdated': new Date('12/01/2014')}},
{multi:true}
);

View File

@@ -39,6 +39,7 @@ exports.createSubscription = function(data, cb) {
p.extraMonths += months; p.extraMonths += months;
} else { } else {
p.dateTerminated = moment(p.dateTerminated).add({months: months}).toDate(); p.dateTerminated = moment(p.dateTerminated).add({months: months}).toDate();
if (!p.dateUpdated) p.dateUpdated = new Date();
} }
if (!p.customerId) p.customerId = 'Gift'; // don't override existing customer, but all sub need a customerId if (!p.customerId) p.customerId = 'Gift'; // don't override existing customer, but all sub need a customerId
} else { } else {