From 6a95fbb3f2f9490d608b0fb2a313bcfd9d684af6 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Thu, 25 May 2023 16:39:56 +0300 Subject: [PATCH] process/price: fix NaN --- apps/web/process/price/reactions/common.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/web/process/price/reactions/common.ts b/apps/web/process/price/reactions/common.ts index dc9eecc..293eac9 100644 --- a/apps/web/process/price/reactions/common.ts +++ b/apps/web/process/price/reactions/common.ts @@ -123,7 +123,7 @@ export default function reactions({ store, apolloClient }: ProcessContext) { (firstPaymentRub) => { const { plPriceRub, addEquipmentPrice, importProgramSum } = $calculation.$values.getValues(); const perc = (firstPaymentRub / (plPriceRub + addEquipmentPrice - importProgramSum)) * 100; - $calculation.element('tbxFirstPaymentPerc').setValue(perc); + $calculation.element('tbxFirstPaymentPerc').setValue(perc || 0); } ); @@ -147,7 +147,7 @@ export default function reactions({ store, apolloClient }: ProcessContext) { (comissionRub) => { const { plPriceRub, addEquipmentPrice, importProgramSum } = $calculation.$values.getValues(); const perc = (comissionRub / (plPriceRub + addEquipmentPrice - importProgramSum)) * 100; - $calculation.element('tbxComissionPerc').setValue(perc); + $calculation.element('tbxComissionPerc').setValue(perc || 0); } ); @@ -187,7 +187,7 @@ export default function reactions({ store, apolloClient }: ProcessContext) { } const perc = (lastPaymentRub / (plPriceRub + addEquipmentPrice - importProgramSum)) * 100; - $calculation.element('tbxLastPaymentPerc').setValue(perc); + $calculation.element('tbxLastPaymentPerc').setValue(perc || 0); } ); }