-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Feature] Add option to control the "cleared state" in Rules #482
Conversation
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Maybe this should grab the checkbox from the transaction row and display itself as “set cleared ⏷ to ☑️”? |
I've added a checkbox instead of a text box to toggle the state. Shouldn't have any data validation issues with that :) |
I've setup a rule that "one of" "venmo, cash, or ca$happ" will result in a true cleared state. When I enter a transfer between two of the three accounts I've specified, only 1 of the transactions receives the rule. It appears the rules aren't applied to both transaction entries of a transfer between accounts. Edit: The "notes" will update as expected, but not the cleared state. I clearly did something wrong. I'll need help 🙏. |
switch (field) { | ||
case 'cleared': | ||
content = ( | ||
<Checkbox | ||
checked={value} | ||
value={value} | ||
onChange={e => onChange(!value)} | ||
/> | ||
); | ||
break; | ||
|
||
default: | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ question: why would we need a switch
case here? IMO we can return the checkbox for all fields. And if sometime in the far future we need to have a different functionality for some other field - we can add it then. But until that time comes we can keep the code simple.
switch (field) { | |
case 'cleared': | |
content = ( | |
<Checkbox | |
checked={value} | |
value={value} | |
onChange={e => onChange(!value)} | |
/> | |
); | |
break; | |
default: | |
} | |
content = ( | |
<Checkbox | |
checked={value} | |
value={value} | |
onChange={e => onChange(!value)} | |
/> | |
); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great point. I'll make the change.
I've learned a little more about the "cleared" state, at least as it pertains to transfers within Actual. The rules are applied upon entering a transaction, therefore any of the rules applied to the first transaction will be applied to the newly created transaction for the transfer. However, because the rules are already applied to the first transaction, they are never directly applied to the 2nd automatically created transaction. Because of this logic, I think it would be wiser to tackle this issue in a different PR. I proved this logic to myself by using this test case:
I'm not making a case that this is wrong or right. I can see a strong argument for the way it's currently implemented. In the case of wanting to control the cleared status of an "Instant cleared" type account such as Venmo or Cash, it's a bit unfortunate. TLDR: This doesn't work as expected for transfers between two accounts that have a "cleared rule" applied. |
@shall0pass your PR is not changing this functionality, right? So I'd say it's an existing limitation, but it should not block introducing the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good 👍
No. This code doesn't change that functionality. It's just my observations when testing the different scenarios. |
Got it! if you're interested to pursue this further, then I'd encourage to open a bug report issue. Otherwise: are you happy if I merge this PR? |
I'm happy with it. Thanks! |
This adds the ability to control the "cleared" flag from the rules dialog by setting the value to true or false.