mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Fix deletion of entries on folder journal through --delete
flag (#1328)
* Re-enable failing folder/DayOne tests * Disable dayone tests again - out of scope for this problem * Fix folder journal deletion by tracking which dates are associated with deleted entries
This commit is contained in:
parent
fa146b1434
commit
5abf974682
2 changed files with 17 additions and 11 deletions
|
@ -83,8 +83,14 @@ class Folder(Journal.Journal):
|
||||||
# print("empty file: {}".format(filename))
|
# print("empty file: {}".format(filename))
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
|
|
||||||
|
def delete_entries(self, entries_to_delete):
|
||||||
|
"""Deletes specific entries from a journal."""
|
||||||
|
for entry in entries_to_delete:
|
||||||
|
self.entries.remove(entry)
|
||||||
|
self._diff_entry_dates.append(entry.date)
|
||||||
|
|
||||||
def parse_editable_str(self, edited):
|
def parse_editable_str(self, edited):
|
||||||
"""Parses the output of self.editable_str and updates it's entries."""
|
"""Parses the output of self.editable_str and updates its entries."""
|
||||||
mod_entries = self._parse(edited)
|
mod_entries = self._parse(edited)
|
||||||
diff_entries = set(self.entries) - set(mod_entries)
|
diff_entries = set(self.entries) - set(mod_entries)
|
||||||
for e in diff_entries:
|
for e in diff_entries:
|
||||||
|
|
|
@ -17,8 +17,8 @@ Feature: Delete entries from journal
|
||||||
| config_file |
|
| config_file |
|
||||||
| basic_onefile.yaml |
|
| basic_onefile.yaml |
|
||||||
| basic_encrypted.yaml |
|
| basic_encrypted.yaml |
|
||||||
# | basic_folder.yaml | @todo
|
| basic_folder.yaml |
|
||||||
# | basic_dayone.yaml | @todo
|
# | basic_dayone.yaml | @todo
|
||||||
|
|
||||||
|
|
||||||
Scenario Outline: Backing out of interactive delete does not change journal
|
Scenario Outline: Backing out of interactive delete does not change journal
|
||||||
|
@ -66,7 +66,7 @@ Feature: Delete entries from journal
|
||||||
Examples: Configs
|
Examples: Configs
|
||||||
| config_file |
|
| config_file |
|
||||||
| basic_onefile.yaml |
|
| basic_onefile.yaml |
|
||||||
# | basic_folder.yaml | @todo
|
| basic_folder.yaml |
|
||||||
# | basic_dayone.yaml | @todo
|
# | basic_dayone.yaml | @todo
|
||||||
|
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ Feature: Delete entries from journal
|
||||||
Examples: Configs
|
Examples: Configs
|
||||||
| config_file |
|
| config_file |
|
||||||
| basic_onefile.yaml |
|
| basic_onefile.yaml |
|
||||||
# | basic_folder.yaml | @todo
|
| basic_folder.yaml |
|
||||||
# | basic_dayone.yaml | @todo
|
# | basic_dayone.yaml | @todo
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ Feature: Delete entries from journal
|
||||||
Examples: Configs
|
Examples: Configs
|
||||||
| config_file |
|
| config_file |
|
||||||
| basic_onefile.yaml |
|
| basic_onefile.yaml |
|
||||||
# | basic_folder.yaml | @todo
|
| basic_folder.yaml |
|
||||||
# | basic_dayone.yaml | @todo
|
# | basic_dayone.yaml | @todo
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ Feature: Delete entries from journal
|
||||||
Examples: Configs
|
Examples: Configs
|
||||||
| config_file |
|
| config_file |
|
||||||
| basic_onefile.yaml |
|
| basic_onefile.yaml |
|
||||||
# | basic_folder.yaml | @todo
|
| basic_folder.yaml |
|
||||||
# | basic_dayone.yaml | @todo
|
# | basic_dayone.yaml | @todo
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ Feature: Delete entries from journal
|
||||||
Examples: Configs
|
Examples: Configs
|
||||||
| config_file |
|
| config_file |
|
||||||
| basic_onefile.yaml |
|
| basic_onefile.yaml |
|
||||||
# | basic_folder.yaml | @todo
|
| basic_folder.yaml |
|
||||||
# | basic_dayone.yaml | @todo
|
# | basic_dayone.yaml | @todo
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ Feature: Delete entries from journal
|
||||||
Examples: Configs
|
Examples: Configs
|
||||||
| config_file |
|
| config_file |
|
||||||
| basic_onefile.yaml |
|
| basic_onefile.yaml |
|
||||||
# | basic_folder.yaml | @todo
|
| basic_folder.yaml |
|
||||||
# | basic_dayone.yaml | @todo
|
# | basic_dayone.yaml | @todo
|
||||||
|
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ Feature: Delete entries from journal
|
||||||
Examples: Configs
|
Examples: Configs
|
||||||
| config_file |
|
| config_file |
|
||||||
| basic_onefile.yaml |
|
| basic_onefile.yaml |
|
||||||
# | basic_folder.yaml | @todo
|
| basic_folder.yaml |
|
||||||
# | basic_dayone.yaml | @todo
|
# | basic_dayone.yaml | @todo
|
||||||
|
|
||||||
|
|
||||||
|
@ -178,5 +178,5 @@ Feature: Delete entries from journal
|
||||||
Examples: Configs
|
Examples: Configs
|
||||||
| config_file |
|
| config_file |
|
||||||
| basic_onefile.yaml |
|
| basic_onefile.yaml |
|
||||||
# | basic_folder.yaml | @todo
|
| basic_folder.yaml |
|
||||||
# | basic_dayone.yaml | @todo
|
# | basic_dayone.yaml | @todo
|
||||||
|
|
Loading…
Add table
Reference in a new issue