From 46131fb496f9a7e0b7652fea5890edc85695c8bb Mon Sep 17 00:00:00 2001 From: Zach Gollwitzer Date: Tue, 10 Dec 2024 18:16:53 -0500 Subject: [PATCH] Fix unique constraint errors on sync --- app/models/account/syncer.rb | 1 + app/models/investment.rb | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/models/account/syncer.rb b/app/models/account/syncer.rb index 43ac980e37d..61a4ef99150 100644 --- a/app/models/account/syncer.rb +++ b/app/models/account/syncer.rb @@ -7,6 +7,7 @@ def initialize(account, start_date: nil) def run holdings = sync_holdings balances = sync_balances(holdings) + account.reload update_account_info(balances, holdings) unless account.plaid_account_id.present? convert_foreign_records(balances) end diff --git a/app/models/investment.rb b/app/models/investment.rb index 29148f06385..6f6c1e577a6 100644 --- a/app/models/investment.rb +++ b/app/models/investment.rb @@ -25,11 +25,6 @@ def icon end def post_sync - broadcast_replace_to( - account, - target: "chart_account_#{account.id}", - partial: account.plaid_account_id.present? ? "investments/chart" : "accounts/show/chart", - locals: { account: account } - ) + broadcast_refresh_to account.family end end