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

Inconsistent database state when assigning transactions via rules to invalid buckets #254

Open
ramonwenger opened this issue Jun 15, 2024 · 2 comments
Milestone

Comments

@ramonwenger
Copy link

Describe the bug
First of all, I didn't realize that buckets are only valid from the month they were first created in. So I started with an import of my transactions of the last 6 months, and then started creating buckets and assigning transaction from the current month (June). I then started creating rules, which helped me using the "Propose Buckets" button, that then suggested the correct bucket.

When going back a month to May, the buckets did not exist / were not valid, so I couldn't choose them, but when using the "Propose Buckets" button, I could still choose the buckets defined in the rules, and save them. But, when returning to the month in question (May in my example), the UI returns an error, saying "Error during loading: Sequence contains no matching element". No transaction for May get displayed then, and I can't edit any transactions from May any more (April is fine again).

I assume that this has to do with the UI trying to display transactions that have invalid buckets, and then crashing. I cannot get out of this state though, as I can't remove the offending buckets from the transactions, so I'm afraid my database is in a bad state right now.

To Reproduce
Steps to reproduce the behavior:

  1. Create bucket in a certain month (e.g. June)
  2. Create a transaction in said month
  3. Create a rule to match this transaction to that bucket
  4. Go back a month (e.g. May)
  5. Create a transaction matching the rule
  6. Use "Propose Bucket" to then assign the transaction from earlier month to bucket in later month
  7. Try to go to earlier month after a reload
  8. The application should now display "Error during loading: Sequence contains no matching element"

Expected behavior
Let me assign newer buckets to older transactions and change the valid from date (or make it explicit), or prevent rules using invalid buckets for the current month from being applied.

Additional helpful details

  • Used version: 1.8.3
  • Database PostgreSQL
@TheAxelander
Copy link
Owner

Thanks for you detailed reporting. Indeed that should not happen that Buckets which are not valid (yet) can be selected.

For intermediate help, my proposal would be to delete everything in table BudgetedTransaction, which should remove all Bucket assignments and let you again edit the transactions in UI.
For your Bucket setup either recreate them in the very first month on where you will start importing transactions. Alternatively you can also modify the ValidFrom date in the database. This would need to be updated in table Bucket and BucketVersion

@TheAxelander TheAxelander added this to the 1.9 milestone Jun 16, 2024
@ramonwenger
Copy link
Author

Thank you @TheAxelander for the quick reply. I already started fresh with a new database, but if it's of any help I can try to fix my old database, just to see if the fix works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🐞Bugs
Development

No branches or pull requests

2 participants