mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 20:44:32 -05:00
Fix various split transaction edits not working (#4186)
* Fix various split transaction edits not working * Add release notes
This commit is contained in:
committed by
GitHub
parent
5e8a24f283
commit
66619fa20d
@@ -78,12 +78,13 @@ export function recalculateSplit(trans: TransactionEntity) {
|
||||
(acc, t) => acc + num(t.amount),
|
||||
0,
|
||||
);
|
||||
|
||||
const { error, ...rest } = trans;
|
||||
return {
|
||||
...trans,
|
||||
error:
|
||||
total === num(trans.amount)
|
||||
? undefined
|
||||
: SplitTransactionError(total, trans),
|
||||
...rest,
|
||||
...(total === num(trans.amount)
|
||||
? {}
|
||||
: { error: SplitTransactionError(total, trans) }),
|
||||
} satisfies TransactionEntity;
|
||||
}
|
||||
|
||||
@@ -276,11 +277,10 @@ export function deleteTransaction(
|
||||
if (trans.id === id) {
|
||||
return null;
|
||||
} else if (trans.subtransactions?.length === 1) {
|
||||
const { error, subtransactions, ...rest } = trans;
|
||||
return {
|
||||
...trans,
|
||||
subtransactions: undefined,
|
||||
...rest,
|
||||
is_parent: false,
|
||||
error: undefined,
|
||||
} satisfies TransactionEntity;
|
||||
} else {
|
||||
const sub = trans.subtransactions?.filter(t => t.id !== id);
|
||||
@@ -308,11 +308,14 @@ export function splitTransaction(
|
||||
makeChild(trans),
|
||||
];
|
||||
|
||||
const { error, ...rest } = trans;
|
||||
|
||||
return {
|
||||
...trans,
|
||||
...rest,
|
||||
is_parent: true,
|
||||
error:
|
||||
num(trans.amount) === 0 ? undefined : SplitTransactionError(0, trans),
|
||||
...(num(trans.amount) === 0
|
||||
? {}
|
||||
: { error: SplitTransactionError(0, trans) }),
|
||||
subtransactions: subtransactions.map(t => ({
|
||||
...t,
|
||||
sort_order: t.sort_order || -1,
|
||||
|
||||
6
upcoming-release-notes/4186.md
Normal file
6
upcoming-release-notes/4186.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [jfdoming]
|
||||
---
|
||||
|
||||
Fix various split transaction edits not working
|
||||
Reference in New Issue
Block a user