Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feedback]: Split in Rules #2379

Open
joel-jeremy opened this issue Feb 20, 2024 · 21 comments
Open

[Feedback]: Split in Rules #2379

joel-jeremy opened this issue Feb 20, 2024 · 21 comments
Labels
experimental feature Related to an experimental feature feedback Single feedback thread for bug reports on a new feature rules Related to rules

Comments

@joel-jeremy
Copy link
Contributor

joel-jeremy commented Feb 20, 2024

Feedback for the experimental Split in rules feature.

@joel-jeremy joel-jeremy added the bug Something isn't working label Feb 20, 2024
@joel-jeremy
Copy link
Contributor Author

@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 joel-jeremy added experimental feature Related to an experimental feature feedback Single feedback thread for bug reports on a new feature rules Related to rules and removed bug Something isn't working labels Feb 20, 2024
@youngcw
Copy link
Contributor

youngcw commented Feb 21, 2024

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?

@jfdoming
Copy link
Contributor

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!

@youngcw youngcw pinned this issue Mar 4, 2024
@Marethyu1
Copy link
Contributor

👋 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

@kyrias
Copy link
Contributor

kyrias commented Mar 31, 2024

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

@kyrias
Copy link
Contributor

kyrias commented Apr 2, 2024

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.

@ByteChild
Copy link

ByteChild commented Apr 3, 2024

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

@youngcw
Copy link
Contributor

youngcw commented Apr 6, 2024

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.

@jfdoming
Copy link
Contributor

jfdoming commented Apr 6, 2024

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
Copy link
Contributor

jfdoming commented Apr 6, 2024

👋 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

@Marethyu1
Copy link
Contributor

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

@youngcw
Copy link
Contributor

youngcw commented Apr 7, 2024

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

@jfdoming
Copy link
Contributor

jfdoming commented Apr 7, 2024

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?

@youngcw
Copy link
Contributor

youngcw commented Apr 7, 2024

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

@jfdoming
Copy link
Contributor

jfdoming commented Apr 8, 2024

@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
Copy link
Contributor

jfdoming commented Apr 8, 2024

hey @ByteChild, sorry you ran into this! Can you try with the preview link on this PR and see if it fixes your issue? #2566

@Marethyu1
Copy link
Contributor

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

@jfdoming
Copy link
Contributor

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.

@Marethyu1
Copy link
Contributor

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 👍

@jfdoming
Copy link
Contributor

jfdoming commented Apr 21, 2024

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!

@MatissJanis
Copy link
Member

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)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experimental feature Related to an experimental feature feedback Single feedback thread for bug reports on a new feature rules Related to rules
Projects
None yet
Development

No branches or pull requests

7 participants