diff --git a/app/models/balance/chart_series_builder.rb b/app/models/balance/chart_series_builder.rb index 034f54c67..c8c733579 100644 --- a/app/models/balance/chart_series_builder.rb +++ b/app/models/balance/chart_series_builder.rb @@ -1,5 +1,5 @@ class Balance::ChartSeriesBuilder - def initialize(account_ids:, currency:, period: Period.last_30_days, interval: "1 day", favorable_direction: "up") + def initialize(account_ids:, currency:, period: Period.last_30_days, interval: nil, favorable_direction: "up") @account_ids = account_ids @currency = currency @period = period diff --git a/app/models/period.rb b/app/models/period.rb index 4188478f2..fd1de6d1c 100644 --- a/app/models/period.rb +++ b/app/models/period.rb @@ -165,7 +165,9 @@ class Period end def interval - if days > 366 + if days > 1825 # 5 years + "1 month" + elsif days > 366 "1 week" else "1 day"