From c9523328da98c25ef773ec13b8719a9a1a19edb0 Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Tue, 30 May 2023 13:45:25 +0300 Subject: [PATCH] fix: exclude values reset results after create-kp --- .../web/process/calculate/reactions/common.ts | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/apps/web/process/calculate/reactions/common.ts b/apps/web/process/calculate/reactions/common.ts index a700f91..f44e88b 100644 --- a/apps/web/process/calculate/reactions/common.ts +++ b/apps/web/process/calculate/reactions/common.ts @@ -2,6 +2,7 @@ import helper from '../lib/helper'; import type { ProcessContext } from '@/process/types'; import { disposableReaction } from '@/utils/mobx'; import { comparer, reaction } from 'mobx'; +import { omit } from 'radash'; export default function reactions({ store, apolloClient }: ProcessContext) { const { $calculation, $tables, $results, $process } = store; @@ -41,15 +42,19 @@ export default function reactions({ store, apolloClient }: ProcessContext) { disposableReaction( () => $process.has('Calculate'), - () => ({ - insurance: { - fingap: $tables.insurance.row('fingap').getValues(), - kasko: $tables.insurance.row('kasko').getValues(), - osago: $tables.insurance.row('osago').getValues(), - }, - payments: $tables.payments.getValues, - values: $calculation.$values.getValues(), - }), + () => { + const values = $calculation.$values.getValues(); + + return { + insurance: { + fingap: $tables.insurance.row('fingap').getValues(), + kasko: $tables.insurance.row('kasko').getValues(), + osago: $tables.insurance.row('osago').getValues(), + }, + payments: $tables.payments.getValues, + values: omit(values, ['IRR_Perc', 'downloadKp', 'lastPaymentRub', 'pi', 'totalPayments']), + }; + }, () => { $results.clear(); },