Skip to content

Commit

Permalink
Safely call liability object when syncing
Browse files Browse the repository at this point in the history
  • Loading branch information
zachgoll committed Nov 22, 2024
1 parent 242eb5c commit c309c8a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/plaid_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ def fetch_and_load_plaid_data
if fetched_liabilities
transaction do
internal_plaid_accounts.each do |internal_plaid_account|
credit = fetched_liabilities.credit.find { |l| l.account_id == internal_plaid_account.plaid_id }
mortgage = fetched_liabilities.mortgage.find { |l| l.account_id == internal_plaid_account.plaid_id }
student = fetched_liabilities.student.find { |l| l.account_id == internal_plaid_account.plaid_id }
credit = fetched_liabilities.credit&.find { |l| l.account_id == internal_plaid_account.plaid_id }
mortgage = fetched_liabilities.mortgage&.find { |l| l.account_id == internal_plaid_account.plaid_id }
student = fetched_liabilities.student&.find { |l| l.account_id == internal_plaid_account.plaid_id }

internal_plaid_account.sync_credit_data!(credit) if credit
internal_plaid_account.sync_mortgage_data!(mortgage) if mortgage
Expand Down

0 comments on commit c309c8a

Please sign in to comment.