diff --git a/app/views/savings_goals/show.html.erb b/app/views/savings_goals/show.html.erb index 41ea41528..e96301c73 100644 --- a/app/views/savings_goals/show.html.erb +++ b/app/views/savings_goals/show.html.erb @@ -202,25 +202,36 @@ <% end %> - <%# Stat row %> + <%# Stat row — combo pace card + contributions count %>
-
-

<%= t(".stats.avg_monthly") %>

-

<%= Money.new(@stats[:avg_monthly], @savings_goal.currency).format %>

-

<%= @stats[:avg_monthly_sub] %>

+ <%# Combo: Avg vs Target pace %> +
+

<%= t(".stats.monthly_pace") %>

+
+

<%= Money.new(@stats[:avg_monthly], @savings_goal.currency).format %>

+

/mo

+ <% if @savings_goal.monthly_target_amount %> +

· <%= t(".stats.target_of", amount: Money.new(@savings_goal.monthly_target_amount, @savings_goal.currency).format) %>

+ <% end %> +
+ <% if @savings_goal.monthly_target_amount %> + <% delta = @savings_goal.monthly_target_amount.to_d - @stats[:avg_monthly].to_d %> + <% if delta.positive? %> +

<%= t(".stats.behind_by", amount: Money.new(delta, @savings_goal.currency).format) %>

+ <% else %> +

<%= t(".stats.above_target_pace") %>

+ <% end %> + <% else %> +

<%= t(".stats.no_required_pace") %>

+ <% end %>
+ + <%# Total contributions %>

<%= t(".stats.total_contributions") %>

<%= @stats[:contributions_count] %>

<%= t(".stats.across_all_accounts") %>

-
-

<%= t(".stats.target_pace") %>

-

- <%= @savings_goal.monthly_target_amount ? Money.new(@savings_goal.monthly_target_amount, @savings_goal.currency).format + "/mo" : t(".stats.no_required_pace") %> -

-

<%= @stats[:monthly_target_sub] %>

-
<%# Bottom row: contributions + funding accounts %> diff --git a/config/locales/views/savings_goals/en.yml b/config/locales/views/savings_goals/en.yml index 69c49323c..e06e72b9a 100644 --- a/config/locales/views/savings_goals/en.yml +++ b/config/locales/views/savings_goals/en.yml @@ -148,6 +148,9 @@ en: no_required_pace: No required pace needs_per_month: "Needs %{amount}/mo" above_target_pace: Above target pace + monthly_pace: Monthly pace + target_of: "target %{amount}/mo" + behind_by: "Behind by %{amount}/mo" states: active: Active paused: Paused