Commit fc8d7da
fix(budget): use filtered available funds in CostBreakdownTable (#1367)
* fix(budget): use filtered available funds in CostBreakdownTable
- 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>
* test(e2e): add filter-aware Available Funds, Remaining Budget, and print-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>
* test(budget): add filteredAvailableFunds unit tests for Available Funds 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>
* test(e2e): fix Remaining Budget arithmetic in Scenario 2
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>
* test(budget): fix two CostBreakdownTable test bugs broken by filteredAvailableFunds 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>
* fix(budget): prefix unused overview param with _ to satisfy ESLint
Co-Authored-By: Claude frontend-developer (Haiku 4.5) <noreply@anthropic.com>
* test(budget): fix pre-existing CostBreakdownTable tests broken by filteredAvailableFunds
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>
---------
Co-authored-by: Frank Steiler <frank@steiler.de>
Co-authored-by: Claude frontend-developer (Haiku 4.5) <noreply@anthropic.com>1 parent b8af9cf commit fc8d7da
4 files changed
Lines changed: 923 additions & 31 deletions
File tree
- client/src/components/CostBreakdownTable
- e2e/tests/budget
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
659 | 659 | | |
660 | 660 | | |
661 | 661 | | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
662 | 667 | | |
663 | 668 | | |
664 | 669 | | |
| |||
0 commit comments