From e5c12ae0610fce3be8669d0d55b62d59b0674cbb Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Wed, 24 Mar 2021 16:00:12 +0300 Subject: [PATCH] load bonuses from kp --- .../Effects/reactions/otherReactions.ts | 72 +++++++++++-------- 1 file changed, 42 insertions(+), 30 deletions(-) diff --git a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts index 78280cb..f1e294d 100644 --- a/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts +++ b/src/client/stores/CalculationStore/Effects/reactions/otherReactions.ts @@ -160,7 +160,7 @@ const reactionEffects: IReactionEffect[] = [ }, }), - calculationStore => ({ + (calculationStore, calculationProcess) => ({ expression: () => { const { indAgentRewardCondition } = calculationStore.values; return indAgentRewardCondition; @@ -191,10 +191,12 @@ const reactionEffects: IReactionEffect[] = [ x => x.evo_reward_conditionid === indAgentRewardConditionId, ); if (indAgentRewardCondition) { - calculationStore.setValue( - 'indAgentRewardSumm', - indAgentRewardCondition.evo_reward_summ || 0, - ); + if (calculationProcess.process !== Process.LoadKp) { + calculationStore.setValue( + 'indAgentRewardSumm', + indAgentRewardCondition.evo_reward_summ || 0, + ); + } calculationStore.setStatus( 'tbxIndAgentRewardSumm', ElementStatus.Default, @@ -233,7 +235,7 @@ const reactionEffects: IReactionEffect[] = [ }, }), - calculationStore => ({ + (calculationStore, calculationProcess) => ({ expression: () => { const { calcDoubleAgentRewardCondition } = calculationStore.values; return calcDoubleAgentRewardCondition; @@ -251,10 +253,12 @@ const reactionEffects: IReactionEffect[] = [ ); if (calcDoubleAgentRewardCondition) { if (calcDoubleAgentRewardCondition.evo_reward_summ) { - calculationStore.setValue( - 'calcDoubleAgentRewardSumm', - calcDoubleAgentRewardCondition.evo_reward_summ, - ); + if (calculationProcess.process !== Process.LoadKp) { + calculationStore.setValue( + 'calcDoubleAgentRewardSumm', + calcDoubleAgentRewardCondition.evo_reward_summ, + ); + } calculationStore.setStatus( 'tbxCalcDoubleAgentRewardSumm', ElementStatus.Default, @@ -268,7 +272,7 @@ const reactionEffects: IReactionEffect[] = [ }, }), - calculationStore => ({ + (calculationStore, calculationProcess) => ({ expression: () => { const { calcBrokerRewardCondition } = calculationStore.values; return calcBrokerRewardCondition; @@ -286,10 +290,12 @@ const reactionEffects: IReactionEffect[] = [ ); if (calcBrokerRewardCondition) { if (calcBrokerRewardCondition.evo_reward_summ) { - calculationStore.setValue( - 'calcBrokerRewardSum', - calcBrokerRewardCondition.evo_reward_summ, - ); + if (calculationProcess.process !== Process.LoadKp) { + calculationStore.setValue( + 'calcBrokerRewardSum', + calcBrokerRewardCondition.evo_reward_summ, + ); + } calculationStore.setStatus( 'tbxCalcBrokerRewardSum', ElementStatus.Default, @@ -303,7 +309,7 @@ const reactionEffects: IReactionEffect[] = [ }, }), - calculationStore => ({ + (calculationStore, calculationProcess) => ({ expression: () => { const { finDepartmentRewardCondtion } = calculationStore.values; return finDepartmentRewardCondtion; @@ -321,10 +327,12 @@ const reactionEffects: IReactionEffect[] = [ ); if (finDepartmentRewardCondtion) { if (finDepartmentRewardCondtion.evo_reward_summ) { - calculationStore.setValue( - 'finDepartmentRewardSumm', - finDepartmentRewardCondtion.evo_reward_summ, - ); + if (calculationProcess.process !== Process.LoadKp) { + calculationStore.setValue( + 'finDepartmentRewardSumm', + finDepartmentRewardCondtion.evo_reward_summ, + ); + } calculationStore.setStatus( 'tbxFinDepartmentRewardSumm', ElementStatus.Default, @@ -932,7 +940,7 @@ const reactionEffects: IReactionEffect[] = [ }, }), - calculationStore => ({ + (calculationStore, calculationProcess) => ({ expression: () => { const { dealerRewardCondition } = calculationStore.values; return dealerRewardCondition; @@ -950,10 +958,12 @@ const reactionEffects: IReactionEffect[] = [ ); if (dealerRewardContition) { if (dealerRewardContition.evo_reward_summ) { - calculationStore.setValue( - 'dealerRewardSumm', - dealerRewardContition.evo_reward_summ, - ); + if (calculationProcess.process !== Process.LoadKp) { + calculationStore.setValue( + 'dealerRewardSumm', + dealerRewardContition.evo_reward_summ, + ); + } calculationStore.setStatus( 'tbxDealerRewardSumm', ElementStatus.Default, @@ -985,7 +995,7 @@ const reactionEffects: IReactionEffect[] = [ }, }), - calculationStore => ({ + (calculationStore, calculationProcess) => ({ expression: () => { const { dealerBrokerRewardCondition } = calculationStore.values; return dealerBrokerRewardCondition; @@ -1003,10 +1013,12 @@ const reactionEffects: IReactionEffect[] = [ ); if (dealerBrokerRewardContition) { if (dealerBrokerRewardContition.evo_reward_summ) { - calculationStore.setValue( - 'dealerBrokerRewardSumm', - dealerBrokerRewardContition.evo_reward_summ, - ); + if (calculationProcess.process !== Process.LoadKp) { + calculationStore.setValue( + 'dealerBrokerRewardSumm', + dealerBrokerRewardContition.evo_reward_summ, + ); + } calculationStore.setStatus( 'tbxDealerBrokerRewardSumm', ElementStatus.Default,