-
Notifications
You must be signed in to change notification settings - Fork 9
Store transaction notes to avoid deleting them when editing a ledger file #223
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
Conversation
…f discarding it. Also allow Posting with no account for notes
The postings now are tuples of 4 elements instead of Triple
…he functions to store the fourth component
Allow notes in valid transactions
If we use the comment lenght, the posting with no notes and the one with notes align weirdly
Thanks for your contribution! I'm a bit busy this week, but I'll take a look this weekend. |
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.
Again, thanks for the contribution!
I left some comments on things I'd like to see improved before merging. If you're not up for handling them, I can also do that for you tomorrow or the day after. Let me know what you'd prefer. 🙂
app/src/main/java/be/chvp/nanoledger/data/parser/TransactionParser.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/be/chvp/nanoledger/ui/common/TransactionFormViewModel.kt
Outdated
Show resolved
Hide resolved
app/src/main/java/be/chvp/nanoledger/ui/common/TransactionFormComponents.kt
Outdated
Show resolved
Hide resolved
Hi! I've just uploaded a bunch of commits to solve the comments. The first one is not solved as I'm not sure if that is the expected behavior as I say in the comment, and I still need to check the trim on the comment regex because with the change we lose the space between the amount and the note as you commented. I will work on the trim issue while awaiting for your answer on the first comment. I will add the tests on the parser when all the changes are done. Also, thank you for this amazing app! |
Nice refactor! I'll take a closer look again in the morning. |
…le, but trim in the UI to look nice in the main view
Hi again! I've just pushed some test to check if notes are parsed correctly. Tell me if you think more tests are needed. |
Code looks good to me, just going to do some manual testing before I approve and merge. Thanks again! |
This PR introduces a member
note
in thePosting
class and allows the memberaccount
to be null in order to store postings that are notes (does not have an account and amount associated). To made this work I've modified theextractPosting
method to, instead of deleting the comment, store it in the newnote
member.As for now adding a note to a posting is not allowed, I've also disable the visualization of postings that are notes in the edit and add ViewModels.
I've displayed the notes that does not have an account and amount in the main view but I'm not sure if that can be confusing as the notes with account and amount are not displayed (but are stored and saved).
An example of a transaction with a note in the main view. The postings that starts with ! also have notes, but are not displayed.

I also changed the conditions to made a transaction valid, as now the app should allow postings with empty accounts and amounts if they are notes.
Fixes #222 .
I've manually tested both in a simple test file (test.ledger.txt) and my own ledger file.