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

Fix DB errors with split transactions #92

Merged
merged 3 commits into from
Jul 8, 2024

Conversation

dospuntos
Copy link
Contributor

  • When editing a split transaction, the original transaction is deleted from the database, and new transactions are created for each split item with the same transaction ID. The ID wasn't correctly set, causing the original transaction to be deleted, and the new transactions to be added to the transaction with ID 0.
  • Deleting an account would not remove associated transactions from the transactionlist table.
  • Converted some queries to use BString::SetToFormat

@humdingerb
Copy link
Member

This improves the situation a lot! There is however still some snag when trying to revert from a split transaction to a normal transaction. For example:

  • Take an existing normal transaction - say it's of the income category "Salary", 2000€ - and edit it.
  • "Show split"
  • Notice, it has the original data in the first line of the list at the bottom - Salary, 2000€
  • Now, change the amount to 1500€ and hit "Add item"
    -> a new row is added with the diff amount and cat "Uncategorized". Good.
    -> The "Total" isn't correctly computed though. Bad.
  • Change the "Uncategorized" category to something, if you want to.
  • "Enter" -> The transaction is saved correctly as a Split.
  • Open the transaction again: All is OK, the total amount is correct. Only the Memo texts are missing.
  • Now, "Remove item" the previously added item (last row).
    -> Total amount isn't corrected
  • If you orrect the remaining items amount to back to the initial transaction's 2000€, all is well.
    If you however just "Remove item" the last remaning row - totally intuitive to me, if you want to "un-split" the transaction to be a "normal" one again - then press "Enter", you get the alert that the split adds up to 0€.

Sorry that got a bit long... :)

* Save memo for split transactions
* Update total field when splits are added/removed
* Allow removing of last split to unsplit transaction
* Display first split memo in transaction list (instead
  of 'No memo')
@dospuntos
Copy link
Contributor Author

Thanks @humdingerb for the review, I finally got around to update the split functionality, and I think it works much better now.

  • Memos are saved
  • Removing the last split works as un-splitting
  • The total is updated when splits are added/removed
  • The memo field is disabled when "Show split" is enabled
  • The transaction list (main window) will show the first split memo if available, instead of "No memo" for split transactions

@humdingerb
Copy link
Member

Very good! Let's merge this then, so we can give it and other issues depending on a better working split feature a good testing.
Thanks!

@humdingerb humdingerb merged commit f22042e into HaikuArchives:master Jul 8, 2024
2 of 3 checks passed
@dospuntos dospuntos deleted the bugs branch July 8, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants