improve robustness

This commit is contained in:
MaysWind
2024-12-12 08:54:19 +08:00
parent 563e328ce3
commit ee029294f1
2 changed files with 11 additions and 7 deletions
+1 -1
View File
@@ -243,7 +243,7 @@ export function getAllFilteredAccountsBalance(categorizedAccounts, accountFilter
isLiability: account.isLiability, isLiability: account.isLiability,
currency: account.currency currency: account.currency
}); });
} else if (account.type === accountConstants.allAccountTypes.MultiSubAccounts) { } else if (account.type === accountConstants.allAccountTypes.MultiSubAccounts && account.subAccounts) {
for (let subAccountIdx = 0; subAccountIdx < account.subAccounts.length; subAccountIdx++) { for (let subAccountIdx = 0; subAccountIdx < account.subAccounts.length; subAccountIdx++) {
const subAccount = account.subAccounts[subAccountIdx]; const subAccount = account.subAccounts[subAccountIdx];
+4
View File
@@ -188,12 +188,14 @@ export const useAccountsStore = defineStore('accounts', {
if (account.type === accountConstants.allAccountTypes.SingleAccount) { if (account.type === accountConstants.allAccountTypes.SingleAccount) {
allAccounts.push(account); allAccounts.push(account);
} else if (account.type === accountConstants.allAccountTypes.MultiSubAccounts) { } else if (account.type === accountConstants.allAccountTypes.MultiSubAccounts) {
if (account.subAccounts) {
for (let j = 0; j < account.subAccounts.length; j++) { for (let j = 0; j < account.subAccounts.length; j++) {
const subAccount = account.subAccounts[j]; const subAccount = account.subAccounts[j];
allAccounts.push(subAccount); allAccounts.push(subAccount);
} }
} }
} }
}
return allAccounts; return allAccounts;
}, },
@@ -210,12 +212,14 @@ export const useAccountsStore = defineStore('accounts', {
if (account.type === accountConstants.allAccountTypes.SingleAccount) { if (account.type === accountConstants.allAccountTypes.SingleAccount) {
allVisibleAccounts.push(account); allVisibleAccounts.push(account);
} else if (account.type === accountConstants.allAccountTypes.MultiSubAccounts) { } else if (account.type === accountConstants.allAccountTypes.MultiSubAccounts) {
if (account.subAccounts) {
for (let j = 0; j < account.subAccounts.length; j++) { for (let j = 0; j < account.subAccounts.length; j++) {
const subAccount = account.subAccounts[j]; const subAccount = account.subAccounts[j];
allVisibleAccounts.push(subAccount); allVisibleAccounts.push(subAccount);
} }
} }
} }
}
return allVisibleAccounts; return allVisibleAccounts;
}, },