The personal finance app for everyone
Fix for certain securities returning incorrect prices
Josh Pigford31d9d926f7a8
diff --git a/app/jobs/fetch_security_info_job.rb b/app/jobs/fetch_security_info_job.rbindex 2612f633..7dff6d0f 100644--- a/app/jobs/fetch_security_info_job.rb+++ b/app/jobs/fetch_security_info_job.rb@@ -12,9 +12,7 @@ class FetchSecurityInfoJob < ApplicationJob)security.update(- name: security_info_response.info.dig("name"),- exchange_acronym: security_info_response.info.dig("exchange", "acronym"),- country_code: security_info_response.info.dig("exchange", "country_code")+ name: security_info_response.info.dig("name"))endenddiff --git a/app/models/account/trade_builder.rb b/app/models/account/trade_builder.rbindex eefdac29..ec252897 100644--- a/app/models/account/trade_builder.rb+++ b/app/models/account/trade_builder.rb@@ -31,9 +31,10 @@ class Account::TradeBuilder < Account::EntryBuilderenddef security- ticker_symbol, exchange_mic = ticker.split("|")+ ticker_symbol, exchange_mic, exchange_acronym, exchange_country_code = ticker.split("|")- security = Security.find_or_create_by(ticker: ticker_symbol, exchange_mic: exchange_mic)+ security = Security.find_or_create_by(ticker: ticker_symbol, exchange_mic: exchange_mic, country_code: exchange_country_code)+ security.update(exchange_acronym: exchange_acronym)FetchSecurityInfoJob.perform_later(security.id)diff --git a/app/models/provider/synth.rb b/app/models/provider/synth.rbindex 764d670f..0e367f1e 100644--- a/app/models/provider/synth.rb+++ b/app/models/provider/synth.rb@@ -138,7 +138,8 @@ class Provider::Synthname: security.dig("name"),logo_url: security.dig("logo_url"),exchange_acronym: security.dig("exchange", "acronym"),- exchange_mic: security.dig("exchange", "mic_code")+ exchange_mic: security.dig("exchange", "mic_code"),+ exchange_country_code: security.dig("exchange", "country_code")}enddiff --git a/app/models/security/synth_combobox_option.rb b/app/models/security/synth_combobox_option.rbindex 6b2f9dc4..efd81db6 100644--- a/app/models/security/synth_combobox_option.rb+++ b/app/models/security/synth_combobox_option.rb@@ -2,7 +2,7 @@ class Security::SynthComboboxOptioninclude ActiveModel::Modelinclude Providable- attr_accessor :symbol, :name, :logo_url, :exchange_acronym, :exchange_mic+ attr_accessor :symbol, :name, :logo_url, :exchange_acronym, :exchange_mic, :exchange_country_codeclass << selfdef find_in_synth(query)@@ -18,7 +18,7 @@ class Security::SynthComboboxOptionenddef id- "#{symbol}|#{exchange_mic}" # submitted by combobox as value+ "#{symbol}|#{exchange_mic}|#{exchange_acronym}|#{exchange_country_code}" # submitted by combobox as valueenddef to_combobox_display