mirror of
https://github.com/we-promise/sure.git
synced 2026-04-18 11:34:13 +00:00
Show UI warning to user when they need provider data but have not setup Synth yet (#1926)
* Simplify provider concerns * Update tests * Add UI warning for missing Synth key if family requires external data
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class Security < ApplicationRecord
|
||||
include Providable
|
||||
include Provided
|
||||
|
||||
before_save :upcase_ticker
|
||||
|
||||
@@ -9,21 +9,6 @@ class Security < ApplicationRecord
|
||||
validates :ticker, presence: true
|
||||
validates :ticker, uniqueness: { scope: :exchange_operating_mic, case_sensitive: false }
|
||||
|
||||
class << self
|
||||
def provider
|
||||
security_prices_provider
|
||||
end
|
||||
|
||||
def search(query)
|
||||
security_prices_provider.search_securities(
|
||||
query: query[:search],
|
||||
dataset: "limited",
|
||||
country_code: query[:country],
|
||||
exchange_operating_mic: query[:exchange_operating_mic]
|
||||
).securities.map { |attrs| new(**attrs) }
|
||||
end
|
||||
end
|
||||
|
||||
def current_price
|
||||
@current_price ||= Security::Price.find_price(security: self, date: Date.current)
|
||||
return nil if @current_price.nil?
|
||||
|
||||
Reference in New Issue
Block a user