mirror of
https://github.com/we-promise/sure.git
synced 2026-04-18 11:34:13 +00:00
feat: split provider check and remove hardcoded synth check (#45)
This commit is contained in:
@@ -69,10 +69,12 @@ class Family < ApplicationRecord
|
||||
country != "US" && country != "CA"
|
||||
end
|
||||
|
||||
def requires_data_provider?
|
||||
def requires_securities_data_provider?
|
||||
# If family has any trades, they need a provider for historical prices
|
||||
return true if trades.any?
|
||||
trades.any?
|
||||
end
|
||||
|
||||
def requires_exchange_rates_data_provider?
|
||||
# If family has any accounts not denominated in the family's currency, they need a provider for historical exchange rates
|
||||
return true if accounts.where.not(currency: self.currency).any?
|
||||
|
||||
@@ -85,7 +87,8 @@ class Family < ApplicationRecord
|
||||
end
|
||||
|
||||
def missing_data_provider?
|
||||
requires_data_provider? && Provider::Registry.get_provider(:synth).nil?
|
||||
(requires_securities_data_provider? && Security.provider.nil?) ||
|
||||
(requires_exchange_rates_data_provider? && ExchangeRate.provider.nil?)
|
||||
end
|
||||
|
||||
def oldest_entry_date
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
<%= icon("chevron-down", color: "warning", class: "group-open:transform group-open:rotate-180") %>
|
||||
</summary>
|
||||
<div class="text-xs py-2 space-y-2">
|
||||
<p>Maybe uses Synth API to fetch historical exchange rates, security prices, and more. This data is required to calculate accurate historical account balances.</p>
|
||||
<p>Sure uses third party providers to fetch historical exchange rates, security prices, and more. This data is required to calculate accurate historical account balances.</p>
|
||||
|
||||
<p>
|
||||
<%= link_to "Add your Synth API key here.", settings_hosting_path, class: "text-yellow-600 underline" %>
|
||||
<%= link_to "Configure your providers here.", settings_hosting_path, class: "text-yellow-600 underline" %>
|
||||
</p>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
Reference in New Issue
Block a user