fix: exclude values reset results after create-kp

This commit is contained in:
vchikalkin 2023-05-30 13:45:25 +03:00
parent 0ed21711db
commit c9523328da

View File

@ -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();
},