From 39c7a832ac1d538aa170b08d7718bb9f5771e0c1 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 29 Aug 2020 11:15:49 +0200 Subject: [PATCH] Support trade-detail also on closed trades --- src/store/modules/ftbot.ts | 9 ++++++--- src/views/Trading.vue | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/store/modules/ftbot.ts b/src/store/modules/ftbot.ts index 31b6c6cd..5f1e372b 100644 --- a/src/store/modules/ftbot.ts +++ b/src/store/modules/ftbot.ts @@ -3,7 +3,7 @@ import { BotState, BlacklistPayload, ForcebuyPayload, Logs, DailyPayload } from export enum UserStoreGetters { openTrades = 'openTrades', - openTradeDetail = 'openTradeDetail', + tradeDetail = 'tradeDetail', closedTrades = 'closedTrades', } @@ -29,8 +29,11 @@ export default { [UserStoreGetters.openTrades](state) { return state.openTrades; }, - [UserStoreGetters.openTradeDetail](state) { - const [dTrade] = state.openTrades.filter((item) => item.trade_id === state.detailTradeId); + [UserStoreGetters.tradeDetail](state) { + let dTrade = state.openTrades.find((item) => item.trade_id === state.detailTradeId); + if (!dTrade) { + dTrade = state.trades.find((item) => item.trade_id === state.detailTradeId); + } return dTrade; }, [UserStoreGetters.closedTrades](state) { diff --git a/src/views/Trading.vue b/src/views/Trading.vue index 07fcb4dd..db1fcf7d 100644 --- a/src/views/Trading.vue +++ b/src/views/Trading.vue @@ -52,7 +52,7 @@ emptyText="No closed trades so far." v-if="!detailTradeId" /> - + @@ -104,7 +104,7 @@ export default class Trading extends Vue { @ftbot.Getter closedTrades!: Array; - @ftbot.Getter [UserStoreGetters.openTradeDetail]!: Trade; + @ftbot.Getter [UserStoreGetters.tradeDetail]!: Trade; }