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

[Feature] "Move" money from one budget to another #29

Open
grablair opened this issue Nov 9, 2023 · 1 comment
Open

[Feature] "Move" money from one budget to another #29

grablair opened this issue Nov 9, 2023 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@grablair
Copy link
Collaborator

grablair commented Nov 9, 2023

No description provided.

@hammem hammem added enhancement New feature or request help wanted Extra attention is needed labels Nov 9, 2023
@grablair
Copy link
Collaborator Author

grablair commented Dec 6, 2023

I'm not convinced implementing this to call the dedicated API (which does exist, as Web_MoveMoneyMutation) is what we want to do.

The user could accomplish this same effect by fetching the current budget amounts for the two target budgets (using the "get budgets" feature that will be added in #52) and calling the "set budget value" API twice (that will be added in #54), one for each of the two budgets, increasing one and decreasing the other appropriately. We could create a helper method that does just that, if we really wanted to.

The benefit of the dedicated API is that it is presumably atomic, so there shouldn't be any risk of data being changed on on the server side while processing is being done on the client side. If you use the manual method described above, there is a non-zero risk that a user could pull down two budgets, make their changes as described above, and then push them to Monarch, while some other process has modified one of those budgets.

But that's really a risk whenever you get a piece of data, change it, and push it, and is incredibly unlikely unless the user is working on data that they didn't just fetch, so I don't think it's really worth the work. In most cases, the window for drift would probably be less than 5 seconds.

Additionally, I have tested it and the dedicated Web_MoveMoneyMutation API does not allow you to move money such that you'd drop the available money in the "from" category below zero. Therefore, using the method described at the beginning of this comment is more flexible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants