From cfd13bac17ce2cccddccf20f8c4a5e4e8d2105e4 Mon Sep 17 00:00:00 2001 From: Botrel Kilian Date: Thu, 21 Apr 2022 15:00:19 +0200 Subject: [PATCH] refactor: rename stats to metrics --- apps/api/src/routes/user/get.js | 2 +- apps/front/src/store/user/index.js | 26 ++++++++++++------------ apps/front/src/views/profile/Profile.vue | 4 ++-- apps/front/src/views/profile/Risk.vue | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/apps/api/src/routes/user/get.js b/apps/api/src/routes/user/get.js index b82be25..4858493 100644 --- a/apps/api/src/routes/user/get.js +++ b/apps/api/src/routes/user/get.js @@ -31,7 +31,7 @@ export default async (req, res, next) => { username, linkingpublickey, }, - stats: { + metrics: { transactions: { deposits: total_deposit_success_count, withdrawals: total_withdraw_success_count, diff --git a/apps/front/src/store/user/index.js b/apps/front/src/store/user/index.js index 328ee08..d57ab1d 100644 --- a/apps/front/src/store/user/index.js +++ b/apps/front/src/store/user/index.js @@ -14,7 +14,7 @@ const defaultState = () => { username: '', linkingpublickey: '', }, - stats: { + metrics: { transactions: { deposits: 0, withdrawals: 0, @@ -62,11 +62,11 @@ export default { }, WITHDRAW_SUCCESS(state, amount) { state.account.available_balance -= parseInt(amount) - state.stats.transactions.withdrawals += 1 + state.metrics.transactions.withdrawals += 1 }, DEPOSIT_SUCCESS(state, amount) { state.account.available_balance += parseInt(amount) - state.stats.transactions.deposits += 1 + state.metrics.transactions.deposits += 1 }, }, getters: { @@ -76,27 +76,27 @@ export default { positionsCount: (state) => { return ( - state.stats.futures.running.positions + - state.stats.futures.opened.positions + - state.stats.futures.closed.positions + - state.stats.futures.canceled.positions + - state.stats.options.running.positions + - state.stats.options.closed.positions + state.metrics.futures.running.positions + + state.metrics.futures.opened.positions + + state.metrics.futures.closed.positions + + state.metrics.futures.canceled.positions + + state.metrics.options.running.positions + + state.metrics.options.closed.positions ) }, globalQuantity: (state, getters, rootState, rootGetters) => { return ( - state.stats.futures.opened.quantity + - state.stats.futures.running.quantity + + state.metrics.futures.opened.quantity + + state.metrics.futures.running.quantity + rootGetters['options/computeDelta'] ) }, usedMargin: (state, getters, rootState, rootGetters) => { return ( - state.stats.futures.opened.margin + - state.stats.futures.running.margin + + state.metrics.futures.opened.margin + + state.metrics.futures.running.margin + rootGetters['options/usedMargin'] ) }, diff --git a/apps/front/src/views/profile/Profile.vue b/apps/front/src/views/profile/Profile.vue index 169a7f7..650872d 100644 --- a/apps/front/src/views/profile/Profile.vue +++ b/apps/front/src/views/profile/Profile.vue @@ -33,9 +33,9 @@ export default { const store = useStore() return { username: computed(() => store.state.user.account.username), - deposits: computed(() => store.state.user.stats.transactions.deposits), + deposits: computed(() => store.state.user.metrics.transactions.deposits), withdrawals: computed( - () => store.state.user.stats.transactions.withdrawals + () => store.state.user.metrics.transactions.withdrawals ), positions: computed(() => store.getters['user/positionsCount']), } diff --git a/apps/front/src/views/profile/Risk.vue b/apps/front/src/views/profile/Risk.vue index 435f283..434b823 100644 --- a/apps/front/src/views/profile/Risk.vue +++ b/apps/front/src/views/profile/Risk.vue @@ -103,8 +103,8 @@ export default { quantity_global: computed(() => store.getters['user/globalQuantity']), quantity_futures: computed( () => - store.state.user.stats.futures.opened.quantity + - store.state.user.stats.futures.running.quantity + store.state.user.metrics.futures.opened.quantity + + store.state.user.metrics.futures.running.quantity ), quantity_options: computed(() => store.getters['options/computeDelta']), }