diff --git a/process/payments/reactions.ts b/process/payments/reactions.ts index f95a859..e63fbfb 100644 --- a/process/payments/reactions.ts +++ b/process/payments/reactions.ts @@ -436,9 +436,12 @@ export default function paymentsReactions( leasingPeriod, shift(seasons, shiftNumber) ); + const shiftedPeriods = new Set( + seasonsConstants.SEASONS_PERIODS[seasonType].map((x) => x + shiftNumber) + ); const rows: Row[] = payments.map((value, i) => ({ value, - status: seasonsConstants.SEASONS_PERIODS[seasonType].includes(i) ? 'Default' : 'Disabled', + status: shiftedPeriods.has(i) ? 'Default' : 'Disabled', })); const firstPaymentPerc = $calculation.getElementValue('tbxFirstPaymentPerc'); const lastPaymentPerc = $calculation.getElementValue('tbxLastPaymentPerc'); @@ -491,10 +494,12 @@ export default function paymentsReactions( leasingPeriod, shift(seasons, shiftNumber) ); - + const shiftedPeriods = new Set( + seasonsConstants.SEASONS_PERIODS[seasonType].map((x) => x + shiftNumber) + ); const rows: Row[] = payments.map((value, i) => ({ value, - status: seasonsConstants.SEASONS_PERIODS[seasonType].includes(i) ? 'Default' : 'Disabled', + status: shiftedPeriods.has(i) ? 'Default' : 'Disabled', })); const firstPaymentPerc = $calculation.getElementValue('tbxFirstPaymentPerc'); const lastPaymentPerc = $calculation.getElementValue('tbxLastPaymentPerc');