1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-25 08:09:38 +02:00

Safely call liability object when syncing
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions

This commit is contained in:
Zach Gollwitzer 2024-11-22 10:41:16 -05:00
parent 242eb5cea1
commit c309c8abf8

View file

@ -107,9 +107,9 @@ class PlaidItem < ApplicationRecord
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