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 failure to import into directory journal #1314

Merged
merged 6 commits into from
Aug 21, 2021

Conversation

micahellison
Copy link
Member

@micahellison micahellison commented Jul 31, 2021

Fixes #999.

A couple issues were at fault:

  • the FolderJournal only writes entries with the "modified" property set to True. However, imported entries weren't marked as "modified"
  • the FolderJournal writing method wasn't identifying new ("modified") dates appropriately

There are some larger issues with this whole object model, mainly that it's not really hiding complexity. Whether you're calling or inheriting a Journal, you've got to know how its innards work, and that makes it difficult to extend. But first and foremost, I wanted to get this bug fixed.

Checklist

  • I have read the contributing doc.
  • I have included a link to the relevant issue number.
  • I have tested this code locally.
  • 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.
  • All tests pass.

@micahellison micahellison changed the base branch from develop to release August 17, 2021 02:49
@micahellison micahellison changed the base branch from release to develop August 17, 2021 02:49
@micahellison micahellison changed the title Fix directory journal import Fix failure to import into directory journal Aug 17, 2021
@wren wren added the bug Something isn't working label Aug 21, 2021
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 7109374 into jrnl-org:develop Aug 21, 2021
@viegasfh
Copy link
Contributor

Regarding this issue, I would to add that even though the import wasn't working in the command line, there is a workaround:

  1. Do a jrnl nameofjournal --edit (or -n 1 --edit) to edit in your text editor
  2. Paste the entries from the text based journal (in vim do an insert text file)
  3. Save and exit

After you save, you will find a message like the following:

[-44 entries deleted, 44 entry modified]

I don't know why it says -44 entries deleted, because it had none of them before. So, it should only say 44 entries added.

Doing a jrnl nameofjournal --export pretty, shows all the entries.

So, maybe this fix could also improve the message displayed so that it says the correct thing in cases where we paste the entries directly in the editor.

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.

Importing to directory-based journals doesn't do anything, and has incorrect message
3 participants