## Problem When an income category contained both incoming and outgoing transactions (e.g. an \"Income from Rents\" category that also holds property-related expense payments), the Sankey endpoint was summing **all** amounts together and applying `abs()` to the net result. Real example reported: | Date | Description | Amount | |------|-------------|--------| | Mar 13 | BIZUM sent — Lavadora | -€124.03 | | Mar 10 | BIZUM received — luz febrero | +€38.04 | | Mar 9 | Endesa energy payment | -€38.04 | | Mar 4 | BIZUM received — agua Febrero | +€41.34 | | Mar 2 | Comunidad de Propietarios | -€105.92 | - Net: **-€188.61** → `abs()` → **€188.61 shown as income** ❌ - Correct: sum of positive flows only → **€79.38** ✅ ## Fix Added a sign filter to `getCategoryBreakdown()` before the `GROUP BY` aggregation: - Income categories: `WHERE transactions.amount > 0` - Expense categories: `WHERE transactions.amount < 0` This ensures the Sankey shows the **actual gross flow** on each side rather than a misleading abs-of-net. ## Test Added a regression test in `CashflowAnalyticsTest` that reproduces the exact five transactions from the reported scenario and asserts the Sankey returns `7938` cents (€79.38) instead of the buggy `18861` (€188.61). |
||
|---|---|---|
| .. | ||
| Actions | ||
| Console/Commands | ||
| Contracts | ||
| Enums | ||
| Events | ||
| Http | ||
| Jobs | ||
| Listeners | ||
| Models | ||
| Notifications | ||
| Policies | ||
| Providers | ||
| Services | ||