From 777f7887b4bd2e7fe7da84917c73532e7770c8c9 Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Fri, 28 Oct 2022 12:41:43 +0200 Subject: [PATCH] fix lint errors --- website/server/libs/payments/subscriptions.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/website/server/libs/payments/subscriptions.js b/website/server/libs/payments/subscriptions.js index 76e240e82b..75a49312e2 100644 --- a/website/server/libs/payments/subscriptions.js +++ b/website/server/libs/payments/subscriptions.js @@ -74,8 +74,15 @@ async function prepareSubscriptionValues (data) { ? data.gift.subscription.key : data.sub.key]; const autoRenews = data.autoRenews !== undefined ? data.autoRenews : true; - const updatedFrom = data.updatedFrom ? shared.content.subscriptionBlocks[data.updatedFrom.key] : undefined; - const months = updatedFrom && Number(updatedFrom.months) !== 1 ? Math.max(0, Number(block.months) - Number(updatedFrom.months)) : Number(block.months); + const updatedFrom = data.updatedFrom + ? shared.content.subscriptionBlocks[data.updatedFrom.key] + : undefined; + let months; + if (updatedFrom && Number(updatedFrom.months) !== 1) { + months = Math.max(0, Number(block.months) - Number(updatedFrom.months)); + } else { + months = Number(block.months); + } const today = new Date(); let group; let groupId;