fix(budget): use filtered available funds in CostBreakdownTable#1367
fix(budget): use filtered available funds in CostBreakdownTable#1367steilerDev merged 7 commits intobetafrom
Conversation
- Compute filteredAvailableFunds from selected budget sources only - Update Available Funds row display to use filtered value - Update Remaining Budget rows (Cost & Net columns) to use filtered funds - Update unused sum variable to use filtered funds for consistency - Hide deselected source rows in print via display: none Fixes budget calculations when budget sources are deselected in the cost breakdown. Co-Authored-By: Claude frontend-developer (Haiku 4.5) <noreply@anthropic.com>
…int-hiding tests Adds a new test.describe block to budget-source-filter.spec.ts covering the CostBreakdownTable changes from fix/1366: filteredAvailableFunds computation and the @media print rule hiding deselected source rows. Scenario 1: Available Funds value updates when a source is deselected. Scenario 2: Remaining Budget Cost column updates when a source is deselected. Scenario 3 (AC #4): Available Funds restores to full total on re-select. Scenario 4 (AC #5): All sources deselected → Available Funds shows €0, not NaN. Scenario 5 (AC #8): Print media hides deselected source rows (display:none) and leaves selected source rows visible. Fixes #1366 Co-Authored-By: Claude e2e-test-engineer (Sonnet 4.5) <noreply@anthropic.com>
…ds and Remaining Budget rows Tests all three filter states for the bug fix (#1362): - All sources selected: filteredAvailableFunds = sum of all source totalAmounts - One source deselected: filteredAvailableFunds excludes deselected source amount - All sources deselected: filteredAvailableFunds = 0 (not unfiltered total) - Remaining Budget Cost and Net columns use filteredAvailableFunds in all states - 'unassigned' source with totalAmount=0 does not affect filteredAvailableFunds - Re-render with empty deselectedSourceIds restores unfiltered values Fixes #1362 Co-Authored-By: Claude qa-integration-tester (Sonnet 4.5) <noreply@anthropic.com>
After deselecting Equity, the server returns a filtered breakdown whose wiTotals.rawProjectedMin/Max = 10 000 (not 20 000), so totalRawProjected drops to 10 000. The correct post-filter Remaining Budget Cost is therefore 150 000 - 10 000 = 140 000, not 130 000. Co-Authored-By: Claude e2e-test-engineer (Sonnet 4.5) <noreply@anthropic.com>
…AvailableFunds change (#1366) The production change in #1366 replaced overview.availableFunds with filteredAvailableFunds (sum of non-deselected budgetSources) for the Available Funds row. Two existing tests had incorrect fixtures that assumed overview.availableFunds was the source of truth: 1. Test 16 "shows Available funds row with formatted currency value": rendered with budgetSources:[] so filteredAvailableFunds=0, not 50000. Fix: add a budgetSource with totalAmount=50000 to the breakdown fixture. 2. Scenario 23 "Remaining Budget row uses filteredAvailableFunds": src-1360-a had totalAmount=100000 but overview.availableFunds=200000, making the fixture internally inconsistent under the new computation. Fix: set src-1360-a.totalAmount=200000 so filteredAvailableFunds=200000, preserving the expected Remaining Budget value of €150,750.00. Also updated the test name and comment to reflect the new semantics. Co-Authored-By: Claude qa-integration-tester (Sonnet 4.5) <noreply@anthropic.com>
Co-Authored-By: Claude frontend-developer (Haiku 4.5) <noreply@anthropic.com>
…teredAvailableFunds After the production fix replacing overview.availableFunds with filteredAvailableFunds (computed from breakdown.budgetSources), 8 pre-existing tests using buildBreakdownWithWI() with empty budgetSources: [] produced filteredAvailableFunds=0, breaking expected Remaining Budget and Available Funds values. Added optional budgetSources parameter to buildBreakdownWithWI() and supplied matching totalAmount values in each failing test so filteredAvailableFunds equals the previously expected overview.availableFunds. Fixes #1366 Co-Authored-By: Claude qa-integration-tester (Sonnet) <noreply@anthropic.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
steilerDev
left a comment
There was a problem hiding this comment.
[ux-designer]
Design review for PR #1367 — filter-aware summary rows + print hiding for deselected source rows.
Checklist
Token adherence
The single new CSS rule (display: none !important) inside the existing @media print block carries no visual token obligations — no colors, spacing, radii, or font sizes are introduced. All existing rules in the block already use design tokens correctly. No hardcoded values introduced.
Visual consistency
The TSX diff is computation-only: filteredAvailableFunds replaces overview.availableFunds in three render sites (Available Funds display value, the valuePositive/valueNegative class gate, and the Remaining Budget value). No JSX structure, class names, or layout changes. Fully consistent with the surrounding component.
Dark mode correctness
No new color properties introduced. No dark mode impact.
Accessibility
The new print rule targets .rowSourceDetailToggle[aria-pressed='false'] — correctly tied to the existing semantic aria-pressed attribute that drives the toggle behavior. This reuses established semantics rather than inventing a parallel data attribute, which is the right approach. No interactive state changes; print media does not affect keyboard navigation or screen reader behavior.
Print behavior
Scoping the rule to @media print is correct — deselected rows are hidden only in the printed output, not in the interactive view. !important is appropriate here given print stylesheets commonly need to override component-level display rules. The selector specificity is appropriate and does not risk bleeding outside the print context.
Verdict
Approved. Minimal and correct — the CSS change is properly scoped, uses no hardcoded values, and the computation change is a pure logic fix with no rendering side-effects.
|
[product-architect] Architectural review of PR #1367 (fix #1366 — filtered Available Funds + print hiding). Verdict: ApproveThe fix is at the correct layer and consistent with established patterns. No architectural concerns block merge. Architecture compliance — correct layer assessmentThe bug report's AC #7 + Notes section suggested reusing the server-side
Given the existing API contract, the client-side derivation Code quality
Test coverageAdequate. 9 unit scenarios cover all axes (all-selected, partial, all-deselected, restore-on-reselect, unassigned with totalAmount=0, payback interaction, negative remaining), and 5 E2E scenarios exercise the full UX flow including Observations (non-blocking)
|
|
🎉 This PR is included in version 2.4.2-beta.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Summary
Fixes #1366
Test plan
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com