From 154a1a971b996713cfae3f62db9e7bc69da433f5 Mon Sep 17 00:00:00 2001 From: Tony Vincent Date: Thu, 7 Nov 2024 16:14:12 +0100 Subject: [PATCH] Exclude inactive accounts from networth calculation and from sidebar (#1432) --- app/controllers/pages_controller.rb | 2 +- app/helpers/accounts_helper.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 9af9d6630d0..79e30f25bbc 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -19,7 +19,7 @@ def dashboard @top_earners = snapshot_account_transactions[:top_earners] @top_savers = snapshot_account_transactions[:top_savers] - @accounts = Current.family.accounts + @accounts = Current.family.accounts.active @account_groups = @accounts.by_group(period: @period, currency: Current.family.currency) @transaction_entries = Current.family.entries.account_transactions.limit(6).reverse_chronological diff --git a/app/helpers/accounts_helper.rb b/app/helpers/accounts_helper.rb index 357ec1daee6..24179b8530c 100644 --- a/app/helpers/accounts_helper.rb +++ b/app/helpers/accounts_helper.rb @@ -52,7 +52,7 @@ def accountable_color(accountable_type) end def account_groups(period: nil) - assets, liabilities = Current.family.accounts.by_group(currency: Current.family.currency, period: period || Period.last_30_days).values_at(:assets, :liabilities) + assets, liabilities = Current.family.accounts.active.by_group(currency: Current.family.currency, period: period || Period.last_30_days).values_at(:assets, :liabilities) [ assets.children.sort_by(&:name), liabilities.children.sort_by(&:name) ].flatten end