fix logic
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user