From caad7e3ae27e81bc9e8b444678e1e186094d2b9c Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 14 Sep 2022 20:44:29 +0200 Subject: [PATCH] Fix historic selection bug --- src/views/Backtesting.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/views/Backtesting.vue b/src/views/Backtesting.vue index 5ff7d42a..13788131 100644 --- a/src/views/Backtesting.vue +++ b/src/views/Backtesting.vue @@ -85,7 +85,7 @@ v-if="btFormMode !== 'visualize' && showLeftBar" :backtest-history="botStore.activeBot.backtestHistory" :selected-backtest-result-key="botStore.activeBot.selectedBacktestResultKey" - @selectionChange="setBacktestResult" + @selectionChange="botStore.activeBot.setBacktestResultKey" /> @@ -411,9 +411,7 @@ export default defineComponent({ const pollInterval = ref(null); const sliderPosition = ref(); - const setBacktestResult = (key: string) => { - botStore.activeBot.setBacktestResultKey(key); - + const selectBacktestResult = () => { // Set parameters for this result strategy.value = botStore.activeBot.selectedBacktestResult.strategy_name; selectedTimeframe.value = botStore.activeBot.selectedBacktestResult.timeframe; @@ -422,6 +420,13 @@ export default defineComponent({ timerange.value = botStore.activeBot.selectedBacktestResult.timerange; }; + watch( + () => botStore.activeBot.selectedBacktestResultKey, + () => { + selectBacktestResult(); + }, + ); + const clickBacktest = () => { const btPayload: BacktestPayload = { strategy: strategy.value, @@ -487,7 +492,6 @@ export default defineComponent({ formatPercent, hasBacktestResult, timeframe, - setBacktestResult, strategy, selectedTimeframe, selectedDetailTimeframe,