mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-04-14 19:47:03 +00:00
fix(plans): when gifting subscription, set plan.dateUpdated so it can
roll gemCapExtra next month. Fixes #4480
This commit is contained in:
parent
c96ae618db
commit
0b28f6df55
2 changed files with 6 additions and 0 deletions
5
migrations/20150107_plan_dateUpdated_null.js
Normal file
5
migrations/20150107_plan_dateUpdated_null.js
Normal 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}
|
||||
);
|
||||
|
|
@ -39,6 +39,7 @@ exports.createSubscription = function(data, cb) {
|
|||
p.extraMonths += months;
|
||||
} else {
|
||||
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
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue