From f93610b5e0c57a610df9ffa1382cd004d493c885 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Mon, 27 Oct 2025 22:33:44 +0800 Subject: [PATCH] total outflows / inflows do not include transfer transactions between unfiltered accounts --- src/stores/statistics.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/stores/statistics.ts b/src/stores/statistics.ts index 0cbed52b..125790ba 100644 --- a/src/stores/statistics.ts +++ b/src/stores/statistics.ts @@ -585,10 +585,22 @@ export const useStatisticsStore = defineStore('statistics', () => { }; } - totalAmount += item.amountInDefaultCurrency; + let includeInTotal: boolean = true; - if (item.amountInDefaultCurrency > 0) { - totalNonNegativeAmount += item.amountInDefaultCurrency; + // total outflows / inflows do not include transfer transactions between unfiltered accounts + if (transactionStatisticsFilter.chartDataType === ChartDataType.OutflowsByAccount.type || + transactionStatisticsFilter.chartDataType === ChartDataType.InflowsByAccount.type) { + if (item.relatedAccount && (!transactionStatisticsFilter.filterAccountIds || !transactionStatisticsFilter.filterAccountIds[item.relatedAccount.id])) { + includeInTotal = false; + } + } + + if (includeInTotal) { + totalAmount += item.amountInDefaultCurrency; + + if (item.amountInDefaultCurrency > 0) { + totalNonNegativeAmount += item.amountInDefaultCurrency; + } } allDataItems[item.account.id] = data;