Skip to content

armgit / maybe

Public Imported from GitHub
0

The personal finance app for everyone

Fix unique constraint errors on sync

Zach Gollwitzer46131fb496f9
diff --git a/app/models/account/syncer.rb b/app/models/account/syncer.rb
index 43ac980e..61a4ef99 100644
--- a/app/models/account/syncer.rb
+++ b/app/models/account/syncer.rb
@@ -7,6 +7,7 @@ class Account::Syncer
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 29148f06..6f6c1e57 100644
--- a/app/models/investment.rb
+++ b/app/models/investment.rb
@@ -25,11 +25,6 @@ class Investment < ApplicationRecord
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