Fix spending-by-category counting transfers as uncategorized spending

Inter-account transfers have no category and a non-null transfer_id.
The spending-by-category command was only filtering out positive amounts
(income) but not transfers, causing the negative side of each transfer
to appear as "Uncategorized" spending.
This commit is contained in:
2026-03-22 13:32:14 -04:00
parent 0e25c8bb90
commit cd340aa3ac

View File

@@ -208,6 +208,7 @@ async function main() {
const txns = await api.getTransactions(acct.id, startDate, endDate);
for (const t of txns) {
if (t.amount >= 0) continue; // skip income
if (t.transfer_id) continue; // skip inter-account transfers
const catName = categoryMap[t.category] || 'Uncategorized';
spending[catName] = (spending[catName] || 0) + t.amount;
}