mirror of
https://github.com/we-promise/sure.git
synced 2026-06-01 00:39:01 +00:00
feat(savings_goals): drop Accounts section from index
The Accounts grid duplicated the sidebar account list. Removing it gives the Goals section more breathing room and the page a tighter narrative: header → KPIs → Goals. Delete Savings::AccountCardComponent, Family#savings_subtype_accounts, the @savings_accounts / @account_goal_counts controller refs, and the related locale keys. Sidebar still shows the savings-subtype Depository accounts under "Cash" — no information is lost.
This commit is contained in:
@@ -15,8 +15,6 @@ class SavingsGoalsController < ApplicationController
|
||||
@completed_goals = all_goals.select { |g| g.state == "completed" }
|
||||
|
||||
@linkable_account_count = Current.family.accounts.where(accountable_type: "Depository").visible.count
|
||||
@savings_accounts = Current.family.savings_subtype_accounts
|
||||
@account_goal_counts = goal_count_per_account(@savings_accounts)
|
||||
@kpi = kpi_payload(@active_goals)
|
||||
@show_search = @active_goals.size > 6
|
||||
end
|
||||
@@ -195,17 +193,6 @@ class SavingsGoalsController < ApplicationController
|
||||
}
|
||||
end
|
||||
|
||||
def goal_count_per_account(accounts)
|
||||
return {} if accounts.empty?
|
||||
|
||||
SavingsGoalAccount
|
||||
.where(account_id: accounts.map(&:id))
|
||||
.joins(:savings_goal)
|
||||
.where.not(savings_goals: { state: %w[archived] })
|
||||
.group(:account_id)
|
||||
.count
|
||||
end
|
||||
|
||||
def stats_for(goal)
|
||||
avg = goal.average_monthly_contribution.to_d
|
||||
sub_avg = if goal.monthly_target_amount && goal.monthly_target_amount.to_d > avg
|
||||
|
||||
Reference in New Issue
Block a user