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

Only read text files that look like entries when opening folder journal #1697

Merged
merged 15 commits into from
Apr 29, 2023

Conversation

micahellison
Copy link
Member

Fixes #1692.

Checklist

  • I have read the contributing doc.
  • I have included a link to the relevant issue number.
  • I have checked to ensure there aren't other open pull requests
    for the same issue.
  • I have written new tests for these changes, as needed.

I didn't add a new test for this specifically, but rather, I modified the test folder journal to include entries that should be ignored. Without the change in FolderJournal.py, the tests blow up quite fantastically.

@micahellison micahellison marked this pull request as draft March 4, 2023 20:32
@micahellison
Copy link
Member Author

micahellison commented Mar 4, 2023

Talking with @wren about this and I now want to re-do this whole PR:

  • instead of using os.walk, explicitly walking through only the folders we want (4-digit year folders on top level, month-like folders on second level; maybe generated a list of months for those)
  • using pathlib instead of os.path for comparisons
  • add unit tests

- move get_files into FolderJournal class and add underscore prefix
- create iterables to get for year/month folders and day files
- make year/month/day file reading strict: only exact expected months and days out of all possible months and days
@micahellison micahellison changed the title Only read text files that look like entries when opening folder journal [WIP] Only read text files that look like entries when opening folder journal Mar 25, 2023
@micahellison micahellison added the bug Something isn't working label Apr 29, 2023
@micahellison micahellison marked this pull request as ready for review April 29, 2023 22:09
@wren wren changed the title [WIP] Only read text files that look like entries when opening folder journal Only read text files that look like entries when opening folder journal Apr 29, 2023
Copy link
Member

@wren wren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕥

@wren wren merged commit 95836a7 into jrnl-org:develop Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

jrnl reads extraneous text files when reading folder journal
2 participants