Skip to content

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

Merged
merged 23 commits into from
Jan 11, 2025
Merged

Store transaction notes to avoid deleting them when editing a ledger file #223

merged 23 commits into from
Jan 11, 2025

Conversation

advy99
Copy link
Contributor

@advy99 advy99 commented Jan 5, 2025

This PR introduces a member note in the Posting class and allows the member account 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 the extractPosting method to, instead of deleting the comment, store it in the new note 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.
imagen

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.

@chvp
Copy link
Owner

chvp commented Jan 6, 2025

Thanks for your contribution! I'm a bit busy this week, but I'll take a look this weekend.

@chvp chvp self-requested a review January 6, 2025 10:42
Copy link
Owner

@chvp chvp left a 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. 🙂

@advy99
Copy link
Contributor Author

advy99 commented Jan 10, 2025

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!

@chvp
Copy link
Owner

chvp commented Jan 10, 2025

Nice refactor! I'll take a closer look again in the morning.

@advy99
Copy link
Contributor Author

advy99 commented Jan 11, 2025

Hi again! I've just pushed some test to check if notes are parsed correctly. Tell me if you think more tests are needed.

@chvp
Copy link
Owner

chvp commented Jan 11, 2025

Code looks good to me, just going to do some manual testing before I approve and merge. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transaction notes are deleted
2 participants