mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-19 02:04:10 +00:00
better init for perkMonthCount
This commit is contained in:
parent
0754c0ff05
commit
f6f1202baf
1 changed files with 2 additions and 2 deletions
|
|
@ -18,7 +18,7 @@ export const schema = new mongoose.Schema({
|
|||
dateUpdated: Date,
|
||||
dateCurrentTypeCreated: Date,
|
||||
extraMonths: { $type: Number, default: 0 },
|
||||
perkMonthCount: { $type: Number, default: 0 },
|
||||
perkMonthCount: { $type: Number, default: -1 },
|
||||
gemsBought: { $type: Number, default: 0 },
|
||||
mysteryItems: { $type: Array, default: () => [] },
|
||||
lastReminderDate: Date, // indicates the last time a subscription reminder was sent
|
||||
|
|
@ -57,7 +57,7 @@ schema.methods.incrementPerkCounterAndReward = async function incrementPerkCount
|
|||
addingNumber = parseInt(adding, 10);
|
||||
}
|
||||
// if perkMonthCount wasn't used before, initialize it.
|
||||
if (this.perkMonthCount === undefined && addingNumber === 1) {
|
||||
if ((this.perkMonthCount === undefined || this.perkMonthCount === -1) && addingNumber === 1) {
|
||||
this.perkMonthCount = (this.consecutive.count - 1) % SUBSCRIPTION_BASIC_BLOCK_LENGTH;
|
||||
} else {
|
||||
this.perkMonthCount += addingNumber;
|
||||
|
|
|
|||
Loading…
Reference in a new issue