Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

fix: keep excluded entries visible in account activity (#2772)

pro3958964817748e16
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb
index 1b84b5416a..1be03dee22 100644
--- a/app/controllers/accounts_controller.rb
+++ b/app/controllers/accounts_controller.rb
@@ -60,8 +60,7 @@ class AccountsController < ApplicationController
@tab = params[:tab]
@accessible_account_ids = Current.user.accessible_accounts.pluck(:id).to_set
@q = params.fetch(:q, {}).permit(:search, status: [])
- entries = @account.entries.where(excluded: false).search(@q).reverse_chronological.includes(:entryable)
-
+ entries = @account.entries.excluding_split_parents.search(@q).reverse_chronological.includes(:entryable)
if statement_tab_active?
build_statement_tab_data
return render_statement_tab_frame if statement_tab_frame_request?
diff --git a/test/controllers/accounts_controller_test.rb b/test/controllers/accounts_controller_test.rb
index 0b23c54b9e..33a98f04f1 100644
--- a/test/controllers/accounts_controller_test.rb
+++ b/test/controllers/accounts_controller_test.rb
@@ -171,6 +171,16 @@ class AccountsControllerTest < ActionDispatch::IntegrationTest
assert_select "turbo-frame##{dom_id(trade_entry)} p.privacy-sensitive", text: expected_amount, count: 1
end
+ test "account activity keeps excluded entries visible so they can be restored" do
+ trade_entry = entries(:trade)
+ trade_entry.update!(excluded: true)
+
+ get account_url(accounts(:investment))
+
+ assert_response :success
+ assert_select "turbo-frame##{dom_id(trade_entry)}"
+ end
+
test "renders investment account with gains chart view" do
get account_url(accounts(:investment), chart_view: "gains")