Improve 'Before split' section in rule splits (#2651)

* Copy category from parent transaction when splitting

* Rename 'Before split' -> 'Apply to all'

* Add release notes

* Update tests to reflect change
This commit is contained in:
Julian Dominguez-Schatz
2024-04-21 18:00:19 -04:00
committed by GitHub
parent 4c29afd424
commit cdad43ff32
6 changed files with 12 additions and 3 deletions

View File

@@ -1020,7 +1020,7 @@ export function EditRule({ modalProps, defaultRule, onSave: originalOnSave }) {
}}
>
{splitIndex === 0
? 'Before split'
? 'Apply to all'
: `Split ${splitIndex}`}
</Text>
{splitIndex && (

View File

@@ -139,7 +139,7 @@ export const RuleRow = memo(
marginBottom: 6,
}}
>
{i ? `Split ${i}` : 'Before split'}
{i ? `Split ${i}` : 'Apply to all'}
</Text>
{split.actions.map((action, j) => (
<ActionExpression

View File

@@ -861,6 +861,7 @@ describe('Transactions', () => {
{
account: accounts[0].id,
amount: -1000,
category: null,
cleared: false,
date: '2017-01-01',
error: null,
@@ -874,6 +875,7 @@ describe('Transactions', () => {
{
account: accounts[0].id,
amount: -1777,
category: null,
cleared: false,
date: '2017-01-01',
error: null,

View File

@@ -622,7 +622,7 @@ export function execActions(actions: Action[], transaction) {
}
}
// The split index 0 is reserved for "Before split" actions.
// The split index 0 is reserved for "Apply to all" actions.
// Remove that entry from the subtransactions.
update.subtransactions = update.subtransactions.slice(1);

View File

@@ -49,6 +49,7 @@ export function makeChild<T extends GenericTransactionEntity>(
return {
amount: 0,
...data,
category: 'category' in data ? data.category : parent.category,
payee: 'payee' in data ? data.payee : parent.payee,
id: 'id' in data ? data.id : prefix + uuidv4(),
account: parent.account,

View File

@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [jfdoming]
---
Make the 'Apply to all' section (fka 'Before split') of rule splits more intuitive