Skip to content

Open source personal finance application

chore: refactor

ilkomeee0a7bf83875
diff --git a/components/stat/Laptop.vue b/components/stat/Laptop.vue
index 8cd4920c..029181e4 100644
--- a/components/stat/Laptop.vue
+++ b/components/stat/Laptop.vue
@@ -16,25 +16,27 @@ onWatch()
const isShowGroup = (type) => {
const p1 = statPage.activeTab === 'details'
- || statPage.activeTab === 'balance'
- || (statPage.activeTab === 'income' && type === 'income')
- || (statPage.activeTab === 'expense' && type === 'expense')
+ || statPage.activeTab === 'balance'
+ || (statPage.activeTab === 'income' && type === 'income')
+ || (statPage.activeTab === 'expense' && type === 'expense')
+
const p2 = statPage.current[type].total > 0
- || (statPage.average && statPage.average[type] !== 0)
- || $store.state.filter.period === 'all'
+ || (statPage.average && statPage.average[type] !== 0)
+ || $store.state.filter.period === 'all'
+
return p1 && p2
}
const isShowTrns = computed(() => {
return statPage.activeTab === 'details'
- && statPage.average?.income !== 0
- && statPage.average?.expense !== 0
- && $store.getters['trns/selectedTrnsIdsWithDate'].length > 0
+ && statPage.average?.income !== 0
+ && statPage.average?.expense !== 0
+ && $store.getters['trns/selectedTrnsIdsWithDate'].length > 0
})
const isShowGroupTrns = computed(() => {
const p1 = statPage.activeTab === 'income' || statPage.activeTab === 'expense'
- const p2 = statPage.average.sum === 0
+ const p2 = statPage.average?.sum === 0
return (p1 || p2) && statPage.activeTab !== 'history'
})
diff --git a/components/trns/getTotal.ts b/components/trns/getTotal.ts
index 9b8dd2b2..24fc6894 100644
--- a/components/trns/getTotal.ts
+++ b/components/trns/getTotal.ts
@@ -84,7 +84,7 @@ export function getTotal(props: TotalProps): TotalReturns {
}
// Transfer v2
- else if (trn.type === TrnType.Transfer && 'incomeWalletId' in trn) {
+ if (trn.type === TrnType.Transfer && 'incomeWalletId' in trn) {
const incomeWallet = walletsItems[trn.incomeWalletId]
const expenseWallet = walletsItems[trn.expenseWalletId]
const incomeAmount = getAmount(trn.incomeAmount, incomeWallet.currency)
@@ -109,7 +109,7 @@ export function getTotal(props: TotalProps): TotalReturns {
}
// Transfer @deprecated
- else if (trn.type === TrnType.Transfer && 'walletFromId' in trn) {
+ if (trn.type === TrnType.Transfer && 'walletFromId' in trn) {
const incomeWallet = walletsItems[trn.walletToId]
const expenseWallet = walletsItems[trn.walletFromId]
const incomeAmount = getAmount(trn.amountTo, incomeWallet.currency)