mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 20:44:32 -05:00
feat: fix categories being set on offbudget transactions (#3705)
* chore: release note * feat: fix categories being set on offbudget transactions * fix: #2266 * fix: small mistake * chore: update comment
This commit is contained in:
committed by
GitHub
parent
a3256f5686
commit
a91a8859ab
@@ -77,7 +77,13 @@ export async function batchUpdateTransactions({
|
||||
await batchMessages(async () => {
|
||||
if (added) {
|
||||
addedIds = await Promise.all(
|
||||
added.map(async t => db.insertTransaction(t)),
|
||||
added.map(async t => {
|
||||
const account = accounts.find(acct => acct.id === t.account);
|
||||
if (account.offbudget === 1) {
|
||||
t.category = null;
|
||||
}
|
||||
return db.insertTransaction(t);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,11 +26,16 @@ async function clearCategory(transaction, transferAcct) {
|
||||
[transferAcct],
|
||||
);
|
||||
|
||||
// We should clear the category to make sure it's not being
|
||||
// accounted for in the budget, unless it should be in the case of
|
||||
// transferring from an on-budget to off-budget account
|
||||
// If the transfer is between two on-budget or two off-budget accounts,
|
||||
// we should clear the category, because the category is not relevant
|
||||
if (fromOffBudget === toOffBudget) {
|
||||
await db.updateTransaction({ id: transaction.id, category: null });
|
||||
if (transaction.transfer_id) {
|
||||
await db.updateTransaction({
|
||||
id: transaction.transfer_id,
|
||||
category: null,
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
6
upcoming-release-notes/3705.md
Normal file
6
upcoming-release-notes/3705.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [UnderKoen]
|
||||
---
|
||||
|
||||
Fix category being set on off-budget accounts
|
||||
Reference in New Issue
Block a user