diff --git a/app/components/goals/funding_accounts_breakdown_component.html.erb b/app/components/goals/funding_accounts_breakdown_component.html.erb index 6f9b397f4..fcf167018 100644 --- a/app/components/goals/funding_accounts_breakdown_component.html.erb +++ b/app/components/goals/funding_accounts_breakdown_component.html.erb @@ -25,19 +25,23 @@ <% rows.each_with_index do |row, idx| %> <% account = row[:account] %> <% color = color_for(account) %> -
+
<%= render Goals::AvatarComponent.new(name: account.name, color: color, size: "sm") %>

<%= account.name %>

- <%= accountable_label(account) %> · <%= row[:balance_money].format %> + <%= accountable_label(account) %> · <%= row[:balance_money].format(precision: 0) %>

-

- <%= rows.size > 1 ? "#{percent_for(row[:balance])}%" : "" %> -

+ <% if rows.size > 1 %> + + <% else %> + + <% end %>
diff --git a/app/components/goals/funding_accounts_breakdown_component.rb b/app/components/goals/funding_accounts_breakdown_component.rb index 6acb71518..91e54203e 100644 --- a/app/components/goals/funding_accounts_breakdown_component.rb +++ b/app/components/goals/funding_accounts_breakdown_component.rb @@ -70,6 +70,7 @@ class Goals::FundingAccountsBreakdownComponent < ApplicationComponent .joins("INNER JOIN transactions ON transactions.id = entries.entryable_id AND entries.entryable_type = 'Transaction'") .where(account_id: account_ids, date: TREND_WINDOW_DAYS.days.ago.to_date..Date.current) .where(excluded: false) + .merge(Transaction.excluding_pending) .pluck(:account_id, :date, :amount) result = Hash.new { |h, k| h[k] = { last_30: 0.to_d, last_90: 0.to_d } } diff --git a/app/models/family.rb b/app/models/family.rb index c421b6ef7..a117f6cc8 100644 --- a/app/models/family.rb +++ b/app/models/family.rb @@ -71,6 +71,7 @@ class Family < ApplicationRecord .joins("INNER JOIN transactions ON transactions.id = entries.entryable_id AND entries.entryable_type = 'Transaction'") .where(account_id: account_ids, date: range) .where(excluded: false) + .merge(Transaction.excluding_pending) .sum(:amount) -net.to_d diff --git a/app/models/goal.rb b/app/models/goal.rb index a0b23b946..a8e8beb62 100644 --- a/app/models/goal.rb +++ b/app/models/goal.rb @@ -129,6 +129,7 @@ class Goal < ApplicationRecord .joins("INNER JOIN transactions ON transactions.id = entries.entryable_id AND entries.entryable_type = 'Transaction'") .where(account_id: account_ids, date: 90.days.ago.to_date..Date.current) .where(excluded: false) + .merge(Transaction.excluding_pending) .sum(:amount) (-net.to_d / 3).round(2) end