From 93e922e7741aae427fe815afb7cc5dbf5eea94de Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Tue, 14 Mar 2023 15:55:41 +0100 Subject: [PATCH] fix logic --- website/server/models/subscriptionPlan.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/website/server/models/subscriptionPlan.js b/website/server/models/subscriptionPlan.js index 07feeb33ac..49a7ca0600 100644 --- a/website/server/models/subscriptionPlan.js +++ b/website/server/models/subscriptionPlan.js @@ -57,11 +57,14 @@ schema.methods.incrementPerkCounterAndReward = async function incrementPerkCount addingNumber = parseInt(adding, 10); } // if perkMonthCount wasn't used before, initialize it. - if ((this.perkMonthCount === undefined || this.perkMonthCount === -1) && addingNumber === 1) { - this.perkMonthCount = (this.consecutive.count - 1) % SUBSCRIPTION_BASIC_BLOCK_LENGTH; - } else { - this.perkMonthCount += addingNumber; + if (this.perkMonthCount === undefined || this.perkMonthCount === -1) { + if (this.planId == 'basic_earned') { + this.perkMonthCount = (this.consecutive.count - 1) % SUBSCRIPTION_BASIC_BLOCK_LENGTH; + } else { + this.perkMonthCount = 0; + } } + this.perkMonthCount += addingNumber; const perks = Math.floor(this.perkMonthCount / 3); if (perks > 0) {