Skip to content

armgit / maybe

Public Imported from GitHub
0

The personal finance app for everyone

Fix trade builder logic

Zach Gollwitzer3f48992aea5c
diff --git a/app/models/trade_builder.rb b/app/models/trade_builder.rb
index 4f0019b9..5a2f9df1 100644
--- a/app/models/trade_builder.rb
+++ b/app/models/trade_builder.rb
@@ -129,8 +129,13 @@ class TradeBuilder
def security
ticker_symbol, exchange_operating_mic = ticker.present? ? ticker.split("|") : [ manual_ticker, nil ]
- Security.find_or_create_by(ticker: ticker_symbol, exchange_operating_mic: exchange_operating_mic) do |s|
- FetchSecurityInfoJob.perform_later(s.id)
- end
+ security = Security.find_or_create_by!(
+ ticker: ticker_symbol,
+ exchange_operating_mic: exchange_operating_mic
+ )
+
+ FetchSecurityInfoJob.perform_later(security.id)
+
+ security
end
end