The personal finance app for everyone (by everyone)
Ruby
feat: split provider check and remove hardcoded synth check (#45)
Vincent Teod04c87449d44
diff --git a/app/models/family.rb b/app/models/family.rbindex 7ebec1c4f6..5f4fdbf87d 100644--- a/app/models/family.rb+++ b/app/models/family.rb@@ -69,10 +69,12 @@ class Family < ApplicationRecordcountry != "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 ratesreturn true if accounts.where.not(currency: self.currency).any?@@ -85,7 +87,8 @@ class Family < ApplicationRecordenddef 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?)enddef oldest_entry_datediff --git a/app/views/accounts/_account_sidebar_tabs.html.erb b/app/views/accounts/_account_sidebar_tabs.html.erbindex 8951cc3cdf..822b8f2d8a 100644--- a/app/views/accounts/_account_sidebar_tabs.html.erb+++ b/app/views/accounts/_account_sidebar_tabs.html.erb@@ -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>