mirror of
https://github.com/we-promise/sure.git
synced 2026-04-18 03:24:09 +00:00
Expand financial providers (#1407)
* Initial implementation * Tiingo fixes * Adds 2 providers, remove 2 * Add extra checks * FIX a big hotwire race condition // Fix hotwire_combobox race condition: when typing quickly, a slow response for // an early query (e.g. "A") can overwrite the correct results for the final query // (e.g. "AAPL"). We abort the previous in-flight request whenever a new one fires, // so stale Turbo Stream responses never reach the DOM. * pipelock * Update price_test.rb * Reviews * i8n * fixes * fixes * Update tiingo.rb * fixes * Improvements * Big revamp * optimisations * Update 20260408151837_add_offline_reason_to_securities.rb * Add missing tests, fixes * small rank tests * FIX tests * Update show.html.erb * Update resolver.rb * Update usd_converter.rb * Update holdings_controller.rb * Update holdings_controller.rb * Update holdings_controller.rb * Update holdings_controller.rb * Update holdings_controller.rb * Update _yahoo_finance_settings.html.erb
This commit is contained in:
@@ -524,12 +524,18 @@ class TransactionsController < ApplicationController
|
||||
if params[:security_id] == "__custom__"
|
||||
# User selected "Enter custom ticker" - check for combobox selection or manual entry
|
||||
if params[:ticker].present?
|
||||
# Combobox selection: format is "SYMBOL|EXCHANGE"
|
||||
ticker_symbol, exchange_operating_mic = params[:ticker].split("|")
|
||||
# Combobox selection: format is "SYMBOL|EXCHANGE|PROVIDER"
|
||||
parsed = Security.parse_combobox_id(params[:ticker])
|
||||
if parsed[:ticker].blank?
|
||||
flash[:alert] = t("transactions.convert_to_trade.errors.enter_ticker")
|
||||
redirect_back_or_to transactions_path
|
||||
return nil
|
||||
end
|
||||
Security::Resolver.new(
|
||||
ticker_symbol.strip,
|
||||
exchange_operating_mic: exchange_operating_mic.presence || params[:exchange_operating_mic].presence,
|
||||
country_code: user_country
|
||||
parsed[:ticker].strip,
|
||||
exchange_operating_mic: parsed[:exchange_operating_mic] || params[:exchange_operating_mic].presence,
|
||||
country_code: user_country,
|
||||
price_provider: parsed[:price_provider]
|
||||
).resolve
|
||||
elsif params[:custom_ticker].present?
|
||||
# Manual entry from combobox's name_when_new or fallback text field
|
||||
@@ -552,12 +558,18 @@ class TransactionsController < ApplicationController
|
||||
end
|
||||
found
|
||||
elsif params[:ticker].present?
|
||||
# Direct combobox (no existing holdings) - format is "SYMBOL|EXCHANGE"
|
||||
ticker_symbol, exchange_operating_mic = params[:ticker].split("|")
|
||||
# Direct combobox (no existing holdings) - format is "SYMBOL|EXCHANGE|PROVIDER"
|
||||
parsed = Security.parse_combobox_id(params[:ticker])
|
||||
if parsed[:ticker].blank?
|
||||
flash[:alert] = t("transactions.convert_to_trade.errors.enter_ticker")
|
||||
redirect_back_or_to transactions_path
|
||||
return nil
|
||||
end
|
||||
Security::Resolver.new(
|
||||
ticker_symbol.strip,
|
||||
exchange_operating_mic: exchange_operating_mic.presence || params[:exchange_operating_mic].presence,
|
||||
country_code: user_country
|
||||
parsed[:ticker].strip,
|
||||
exchange_operating_mic: parsed[:exchange_operating_mic] || params[:exchange_operating_mic].presence,
|
||||
country_code: user_country,
|
||||
price_provider: parsed[:price_provider]
|
||||
).resolve
|
||||
elsif params[:custom_ticker].present?
|
||||
# Manual entry from combobox's name_when_new (no existing holdings path)
|
||||
|
||||
Reference in New Issue
Block a user