mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-19 10:14:11 +00:00
fix logic
This commit is contained in:
parent
f6f1202baf
commit
93e922e774
1 changed files with 7 additions and 4 deletions
|
|
@ -57,11 +57,14 @@ schema.methods.incrementPerkCounterAndReward = async function incrementPerkCount
|
||||||
addingNumber = parseInt(adding, 10);
|
addingNumber = parseInt(adding, 10);
|
||||||
}
|
}
|
||||||
// if perkMonthCount wasn't used before, initialize it.
|
// if perkMonthCount wasn't used before, initialize it.
|
||||||
if ((this.perkMonthCount === undefined || this.perkMonthCount === -1) && addingNumber === 1) {
|
if (this.perkMonthCount === undefined || this.perkMonthCount === -1) {
|
||||||
this.perkMonthCount = (this.consecutive.count - 1) % SUBSCRIPTION_BASIC_BLOCK_LENGTH;
|
if (this.planId == 'basic_earned') {
|
||||||
} else {
|
this.perkMonthCount = (this.consecutive.count - 1) % SUBSCRIPTION_BASIC_BLOCK_LENGTH;
|
||||||
this.perkMonthCount += addingNumber;
|
} else {
|
||||||
|
this.perkMonthCount = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
this.perkMonthCount += addingNumber;
|
||||||
|
|
||||||
const perks = Math.floor(this.perkMonthCount / 3);
|
const perks = Math.floor(this.perkMonthCount / 3);
|
||||||
if (perks > 0) {
|
if (perks > 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue