Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

FIX networth chart dashboard (#1449)

soky srmc57c08c78a0b
diff --git a/app/models/balance/chart_series_builder.rb b/app/models/balance/chart_series_builder.rb
index 034f54c674..c8c733579e 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 4188478f21..fd1de6d1c1 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"