fix(goals): keep archived cards out of the filter loop entirely

The earlier 'filter archived too' attempts kept toggling the archived
section based on chip state, which produced more confusion than value
(filter shows partial counts, archived hides on some chips, etc.).
Step back: archived stays in its own collapsed-by-default section,
always visible, never reacts to the chip / search filter. Render
the cards with filterable: false so they don't add a filter target
in the first place — no JS handling needed, and the active grid +
chips behave exactly like they did before this whole thread.
This commit is contained in:
Guillem Arias
2026-05-18 22:16:38 +02:00
parent 746d733599
commit 82e3ba8ef7
4 changed files with 9 additions and 7 deletions

View File

@@ -20,9 +20,10 @@ class GoalsController < ApplicationController
.sort_by { |g| [ g.paused? ? 3 : ACTIVE_STATUS_RANK.fetch(g.status, 4), g.name.downcase ] }
@completed_goals = all_goals.select { |g| g.state == "completed" }.sort_by { |g| g.name.downcase }
@archived_goals = all_goals.select { |g| g.state == "archived" }
# Completed goals join the chip-filterable grid below the active ones so
# the `completed` chip can isolate them. Archived stays in the separate
# collapsed-by-default section below.
# Completed goals join the chip-filterable grid below the active ones
# so the `completed` chip can isolate them. Archived stays in a
# separate collapsed-by-default section, opted out of the filter
# entirely (rendered with filterable: false).
@grid_goals = @active_goals + @completed_goals
@linkable_account_count = Current.family.accounts.where(accountable_type: "Depository").visible.count