fix(costs): the count beside the total adds up what it does, and its left-out chip counts all again (#2819, #2839)

With a category left out the total card still counted every expense, and in
the table view the only way back was to switch views; the chip now brings
everything back. The phone says what is left out once, under the total.
Linking a receipt offers pictures and PDFs only, like the upload.
This commit is contained in:
Maurice
2026-11-13 10:49:28 +01:00
parent 43a8984e4c
commit fcbb538c24
7 changed files with 40 additions and 13 deletions
@@ -7,6 +7,7 @@ import {
buildCostsCsv,
categoryBreakdown,
computeTotals,
countedExpenses,
currencyOptions,
filterBudgetItems,
isPlainSplit,
@@ -203,4 +204,11 @@ describe('costsModel: categories left out of the totals (#2819)', () => {
['food', false, 100],
]);
});
it('FE-BUDGET-COSTSMODEL-016: the expense count beside the total counts what the total adds up', () => {
const food = expense({ category: 'food', total_price: 40 });
const hotel = expense({ category: 'accommodation', total_price: 100 });
expect(countedExpenses([food, hotel, food])).toBe(3);
expect(countedExpenses([food, hotel, food], new Set<CostCategory>(['food']))).toBe(1);
});
});