From c8afffe5b2eb9569f81cb5fcf26544e9889201ca Mon Sep 17 00:00:00 2001 From: Chika Date: Tue, 4 Oct 2022 20:11:26 +0300 Subject: [PATCH] process/payments(degression): fix reaction error --- process/payments/reactions.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/process/payments/reactions.ts b/process/payments/reactions.ts index 9dd1841..a6ee205 100644 --- a/process/payments/reactions.ts +++ b/process/payments/reactions.ts @@ -214,10 +214,9 @@ export default function paymentsReactions( /** * Дегрессия */ - const mapGraphTypeToSeasonTypes: { [key: number]: Array } = { - 100_000_001: [100_000_003, 100_000_004, 100_000_005, 100_000_006, 100_000_007], - 100_000_003: [100_000_000, 100_000_001, 100_000_002], - }; + const degressionSeasonTypes = new Set([ + 100_000_003, 100_000_004, 100_000_005, 100_000_006, 100_000_007, + ]); reaction( () => { @@ -226,15 +225,14 @@ export default function paymentsReactions( return graphType; }, (graphType) => { - if (!graphType) { + if (!graphType || graphType !== 100_000_001) { $calculation.setElementOptions('selectSeasonType', []); return; } - const allowedSeasonTypes = mapGraphTypeToSeasonTypes[graphType]; const selectSeasonTypeOptions = selectSeasonType.filter((option) => - allowedSeasonTypes.includes(option.value) + degressionSeasonTypes.has(option.value) ); $calculation.setElementOptions('selectSeasonType', selectSeasonTypeOptions); }