mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-02 20:15:22 +02:00
Fix sync error when security missing
This commit is contained in:
parent
c3248cd796
commit
d592495be5
3 changed files with 10 additions and 6 deletions
|
@ -158,19 +158,21 @@ class PlaidAccount < ApplicationRecord
|
|||
end
|
||||
|
||||
def get_security(plaid_security, securities)
|
||||
security = nil
|
||||
return nil if plaid_security.nil?
|
||||
|
||||
if plaid_security.ticker_symbol.present?
|
||||
security = plaid_security
|
||||
security = if plaid_security.ticker_symbol.present?
|
||||
plaid_security
|
||||
else
|
||||
security = securities.find { |s| s.security_id == plaid_security.proxy_security_id }
|
||||
securities.find { |s| s.security_id == plaid_security.proxy_security_id }
|
||||
end
|
||||
|
||||
return nil if security.nil? || security.ticker_symbol.blank?
|
||||
|
||||
Security.find_or_create_by!(
|
||||
ticker: security.ticker_symbol,
|
||||
exchange_mic: security.market_identifier_code || "XNAS",
|
||||
country_code: "US"
|
||||
) if security.present?
|
||||
)
|
||||
end
|
||||
|
||||
def transfer?(plaid_txn)
|
||||
|
|
|
@ -29,6 +29,7 @@ class Sync < ApplicationRecord
|
|||
end
|
||||
|
||||
def fail!(error)
|
||||
Sentry.capture_exception(error)
|
||||
update! status: :failed, error: error.message, last_ran_at: Time.current
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue