actual icon indicating copy to clipboard operation
actual copied to clipboard

[Feedback]: Split in Rules

Open joel-jeremy opened this issue 1 year ago • 20 comments

Feedback for the experimental Split in rules feature.

joel-jeremy avatar Feb 20 '24 08:02 joel-jeremy

@jfdoming I noticed that we can split transactions in rules on all stages (Pre, Default, Post). Does it make sense to just allow a split on Post? This way, we can probably get rid of the Before split functionality. The Post split rule will apply the split on whatever the result of the Pre and Default stages is.

joel-jeremy avatar Feb 20 '24 08:02 joel-jeremy

I think it would make sense to block setting the category in the "before split" part of a split rule. Currently it can be set, but does nothing. Maybe pass that on to the splits if its set there?

youngcw avatar Feb 21 '24 18:02 youngcw

I think it would make sense to block setting the category in the "before split" part of a split rule. Currently it can be set, but does nothing. Maybe pass that on to the splits if its set there?

Hmm, so the "Before split" bit was because I wasn't sure what to do if you (1) add some actions to a non-split rule, and then (2) split the rule; and also it was supposed to be a way to apply actions across all splits. If setting the category doesn't work (I'll check and investigate why) that seems like something that should be fixed, but I'm curious if you have other ideas on how this could behave.

Thanks for the feedback btw!

jfdoming avatar Feb 22 '24 01:02 jfdoming

👋 Im having trouble getting the split rule to apply when importing a transaction via the api.

I have tried importing via a file and works, however I can't seem to get it working with the api. Hoping you can help confirm if it's a me thing or if there is some functionality missing.

Example code using the api

...
const accountId = '04bbaabb-5a1e-418b-abe4-678493f67043'
const transaction =  {
        "account": "33644b5c-fcfd-4580-9056-a28278835fb8",
        "date": "2024-03-25",
        "payee_name": "New World",
        "amount": 54500,
        "notes": "test"
    }

await api.importTransactions(accountId, [transaction])

Example rules I have setup

image

This is the transaction I get image

where as if I import via a file

Account,Date,Payee,Notes,Category,Amount,Cleared
General,2024-03-25,New World,Test Note,Food,54.5,Cleared

I get the split rule applied

image

Keen to understand whether im using the api wrong or whether it doesn't support applying the split transaction when uploading via the api. Any help would be appreciated, thanks

Marethyu1 avatar Mar 25 '24 07:03 Marethyu1

It would be nice if the functionality for creating rules from existing transactions would pull in the splits.

kyrias avatar Mar 31 '24 23:03 kyrias

I have an off-budget account for a loan I have, and when the charge comes in I turn it into a split transaction with the principal part being a transfer to the off-budget account and the interest part going to the original payee.

Since the principal vs interest amount is different each month I tried setting the split rule to set both splits to an amount of 0, hoping that it would leave the transaction in the same state as would happen if you did this manually, but having just synced one of these charges I see that an extra split is added with the difference.

I guess that's a reasonable default way to handle it, but my preferred way to handle these loan payments in particular would be to not have an extra split created with the extra and for something like the "X uncategorized transactions" notice to be shown for splits where the full balance hasn't been assigned.

kyrias avatar Apr 02 '24 12:04 kyrias

I noticed a bug: If I enter a fixed value for a split in German format 123,45 then the amount will not be saved. I have to enter 123.45

Example: I created the following rule:

2024-04-03_13h32_26 I typed in the total amount with a comma as separator. The first split also with a comma and the second split with a dot.

Only the second split gets saved:

2024-04-03_13h33_03

ByteChild avatar Apr 03 '24 11:04 ByteChild

A split I have didn't work this month. One I had on a different budget did work, that one was with a auto posting schedule.

youngcw avatar Apr 06 '24 19:04 youngcw

A split I have didn't work this month. One I had on a different budget did work, that one was with a auto posting schedule.

Sorry, just to confirm, the auto posting one did work and the regular rule-based on didn't? Were you able to get the rule to apply manually?

jfdoming avatar Apr 06 '24 23:04 jfdoming

👋 Im having trouble getting the split rule to apply when importing a transaction via the api.

I have tried importing via a file and works, however I can't seem to get it working with the api. Hoping you can help confirm if it's a me thing or if there is some functionality missing.

Example code using the api

...
const accountId = '04bbaabb-5a1e-418b-abe4-678493f67043'
const transaction =  {
        "account": "33644b5c-fcfd-4580-9056-a28278835fb8",
        "date": "2024-03-25",
        "payee_name": "New World",
        "amount": 54500,
        "notes": "test"
    }

await api.importTransactions(accountId, [transaction])

Example rules I have setup

image This is the transaction I get image

where as if I import via a file

Account,Date,Payee,Notes,Category,Amount,Cleared
General,2024-03-25,New World,Test Note,Food,54.5,Cleared

I get the split rule applied

image Keen to understand whether im using the api wrong or whether it doesn't support applying the split transaction when uploading via the api. Any help would be appreciated, thanks

Hey, I don't believe I implemented the API path yet. Happy to look into this

jfdoming avatar Apr 06 '24 23:04 jfdoming

Id be happy to have a crack at implementing the api path if you can point me in the right direction

Marethyu1 avatar Apr 06 '24 23:04 Marethyu1

A split I have didn't work this month. One I had on a different budget did work, that one was with a auto posting schedule.

Sorry, just to confirm, the auto posting one did work and the regular rule-based on didn't? Were you able to get the rule to apply manually?

The auto posting one did work. I cant get this one on my main budget to have the rule apply. Even manually applying the rule wasn't working even though the transaction showed up in the match list

youngcw avatar Apr 07 '24 04:04 youngcw

A split I have didn't work this month. One I had on a different budget did work, that one was with a auto posting schedule.

Sorry, just to confirm, the auto posting one did work and the regular rule-based on didn't? Were you able to get the rule to apply manually?

The auto posting one did work. I cant get this one on my main budget to have the rule apply. Even manually applying the rule wasn't working even though the transaction showed up in the match list

That sounds odd... What were the criteria/actions, if you don't mind me asking?

jfdoming avatar Apr 07 '24 04:04 jfdoming

That rule is based on payee and approx amount. Im pretty sure that rule has triggered in the past fine. Ill keep watching to see if it keeps happening

youngcw avatar Apr 07 '24 04:04 youngcw

@Marethyu1 check out https://github.com/actualbudget/actual/pull/2569/files#diff-21c5b30e746cbe9a3777fbd9c245d00284320a22e7a18e6c443c2466d1b97767R1099 for details on how to construct splits. Not sure if you need to expose this directly via the API or provide some logical wrapper! Notes:

  • each non-zero split should have a set-split-amount action to compute the value of the split
  • a split with index 0 should be optional

jfdoming avatar Apr 08 '24 04:04 jfdoming

hey @ByteChild, sorry you ran into this! Can you try with the preview link on this PR and see if it fixes your issue? https://github.com/actualbudget/actual/pull/2566

jfdoming avatar Apr 08 '24 04:04 jfdoming

Hi folks, just added a VRT test in #2604 Whilst writing the test I noticed a couple of things

1. Setting a category in the before split doesn't make sense.

Behaviour: If add a split transaction and set the before split category to anything (eg 'food') when I enter the transaction it the category gets set to split instead of the category I set.

Example rule: Rule that sets before split category to Food image

Example Transaction: Here the category is set to Split for the parent transaction image

Potential fix: Because the parent transaction category for a split transaction will always be split, maybe we should stop users from setting a before split category in the ui? Keen to know what y'all think / if this makes sense?

2. When manually entering a split transaction you have to set payment amount first

In order for a split transaction rule to apply when being entered manually you have to set the payment amount first. This is pretty confusing and was discussed here. Definitely agree that this would be great an enhancement If anyone has time to look into it

Marethyu1 avatar Apr 14 '24 22:04 Marethyu1

Hi folks, just added a VRT test in #2604 Whilst writing the test I noticed a couple of things

1. Setting a category in the before split doesn't make sense.

Behaviour: If add a split transaction and set the before split category to anything (eg 'food') when I enter the transaction it the category gets set to split instead of the category I set.

Example rule: Rule that sets before split category to Food image

Example Transaction: Here the category is set to Split for the parent transaction image

Potential fix: Because the parent transaction category for a split transaction will always be split, maybe we should stop users from setting a before split category in the ui? Keen to know what y'all think / if this makes sense?

2. When manually entering a split transaction you have to set payment amount first

In order for a split transaction rule to apply when being entered manually you have to set the payment amount first. This is pretty confusing and was discussed here. Definitely agree that this would be great an enhancement If anyone has time to look into it

Hey! Thanks for the feedback.

For 1, the idea was that the actions there apply to all splits. I think a rename from "Before split" to "Apply to all" makes sense; what do you think? (Side note: seems like that logic isn't working! I'll look into it and fix.)

For 2, good idea, although not sure how difficult this would be to implement. I'll take a crack at it when I have time.

jfdoming avatar Apr 14 '24 22:04 jfdoming

For 1, the idea was that the actions there apply to all splits. I think a rename from "Before split" to "Apply to all" makes sense; what do you think? (Side note: seems like that logic isn't working! I'll look into it and fix.)

Oh this makes a lot of sense - was confused as the logic wasn't working. I guess something that is kind of interesting is that it means you can apply a blanket category to all splits, and then within a split override a specific one. That actually seems reasonable enough to me. In terms of renaming it to 'apply to all', I agree that would be more clear to me.

Ive attached a screenshot below showing example case where you could override an individual category. image

Assuming we can get it working what you are proposing makes sense to me 👍

Marethyu1 avatar Apr 14 '24 23:04 Marethyu1

For 1, the idea was that the actions there apply to all splits. I think a rename from "Before split" to "Apply to all" makes sense; what do you think? (Side note: seems like that logic isn't working! I'll look into it and fix.)

Oh this makes a lot of sense - was confused as the logic wasn't working. I guess something that is kind of interesting is that it means you can apply a blanket category to all splits, and then within a split override a specific one. That actually seems reasonable enough to me. In terms of renaming it to 'apply to all', I agree that would be more clear to me.

Ive attached a screenshot below showing example case where you could override an individual category. image

Assuming we can get it working what you are proposing makes sense to me 👍

Opened a PR here with the changes we discussed to the "Before split" section, feel free to try it out here and let me know what you think!

jfdoming avatar Apr 21 '24 01:04 jfdoming

Looks like we've not had any new feedback for a while. Any objections if we release this as a first party feature (i.e. remove the feature flag gating)?

MatissJanis avatar May 16 '24 19:05 MatissJanis

Looks like we've not had any new feedback for a while. Any objections if we release this as a first party feature (i.e. remove the feature flag gating)?

I'm good to do that! I have two related outstanding PRs I'd like to fixup and get merged, and then I'll open one to remove the feature flag logic.

jfdoming avatar May 21 '24 15:05 jfdoming

@jfdoming Another good to have would be to have the preview transactions show the splits. Right now it only shows the parent transaction as upcoming.

joel-jeremy avatar May 28 '24 23:05 joel-jeremy

I have noticed that in the rule edit modal that only non-split or child transactions show up in the list of possible candidates for the rule. Maybe for rules that split, it should show the parent only and not look at children transactions.

This seems to make it hard to know if a split rule is matching correctly.

youngcw avatar May 29 '24 19:05 youngcw