From 6d2d340cf3f965b2d951fd3a68a2110735e683d3 Mon Sep 17 00:00:00 2001 From: soky srm Date: Sun, 12 Apr 2026 18:09:03 +0200 Subject: [PATCH] FIX networth chart dashboard (#1449) --- app/models/balance/chart_series_builder.rb | 2 +- app/models/period.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) 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"