mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-29 10:09:39 +02:00
Fix security search
This commit is contained in:
parent
9fadfe074b
commit
29f445d75e
3 changed files with 10 additions and 4 deletions
|
@ -20,9 +20,7 @@ class Security < ApplicationRecord
|
||||||
symbol: ticker,
|
symbol: ticker,
|
||||||
name: name,
|
name: name,
|
||||||
logo_url: logo_url,
|
logo_url: logo_url,
|
||||||
exchange_acronym: exchange_acronym,
|
|
||||||
exchange_operating_mic: exchange_operating_mic,
|
exchange_operating_mic: exchange_operating_mic,
|
||||||
exchange_country_code: country_code
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,15 @@ module Security::Provided
|
||||||
response = provider.search_securities(symbol, country_code: country_code, exchange_operating_mic: exchange_operating_mic)
|
response = provider.search_securities(symbol, country_code: country_code, exchange_operating_mic: exchange_operating_mic)
|
||||||
|
|
||||||
if response.success?
|
if response.success?
|
||||||
response.data
|
response.data.map do |provider_security|
|
||||||
|
# Need to map to domain model so Combobox can display via to_combobox_option
|
||||||
|
Security.new(
|
||||||
|
ticker: provider_security.symbol,
|
||||||
|
name: provider_security.name,
|
||||||
|
logo_url: provider_security.logo_url,
|
||||||
|
exchange_operating_mic: provider_security.exchange_operating_mic,
|
||||||
|
)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class Security::SynthComboboxOption
|
class Security::SynthComboboxOption
|
||||||
include ActiveModel::Model
|
include ActiveModel::Model
|
||||||
|
|
||||||
attr_accessor :symbol, :name, :logo_url, :exchange_acronym, :exchange_country_code, :exchange_operating_mic
|
attr_accessor :symbol, :name, :logo_url, :exchange_operating_mic
|
||||||
|
|
||||||
def id
|
def id
|
||||||
"#{symbol}|#{exchange_operating_mic}" # submitted by combobox as value
|
"#{symbol}|#{exchange_operating_mic}" # submitted by combobox as value
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue