diff --git a/app/models/savings_goal.rb b/app/models/savings_goal.rb index 723b479bf..53141e5e0 100644 --- a/app/models/savings_goal.rb +++ b/app/models/savings_goal.rb @@ -146,9 +146,11 @@ class SavingsGoal < ApplicationRecord { date: c.contributed_at.to_s, value: running.to_f } end + earliest = [ created_at.to_date, sorted.first&.contributed_at ].compact.min + { saved_series: saved_series, - start_date: created_at.to_date.to_s, + start_date: earliest.to_s, today: Date.current.to_s, target_date: target_date&.to_s, target_amount: target_amount.to_f, diff --git a/app/views/savings_goals/show.html.erb b/app/views/savings_goals/show.html.erb index f77d75421..89e20d5c7 100644 --- a/app/views/savings_goals/show.html.erb +++ b/app/views/savings_goals/show.html.erb @@ -182,13 +182,14 @@

<%= t(".projection.heading") %>

<%= @stats[:projection_summary].html_safe %>

+ <% projection_color = @savings_goal.status == :on_track ? "var(--color-green-600)" : "var(--color-yellow-600)" %>
- + <%= t(".projection.legend_saved") %> - + <%= t(".projection.legend_projection") %>