mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-29 22:16:13 +02:00
Add added option to _print_edited_summary (#1366)
* Add added option to _print_edited_summary * Add tests for counts of entries added, modified, and deleted * Add test for modifying an entry rather than replacing it Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
parent
ffc8bdd5f1
commit
ba3fd2202f
2 changed files with 92 additions and 1 deletions
|
@ -275,13 +275,18 @@ def _edit_search_results(config, journal, old_entries, **kwargs):
|
|||
|
||||
def _print_edited_summary(journal, old_stats, **kwargs):
|
||||
stats = {
|
||||
"added": len(journal) - old_stats["count"],
|
||||
"deleted": old_stats["count"] - len(journal),
|
||||
"modified": len([e for e in journal.entries if e.modified]),
|
||||
}
|
||||
|
||||
prompts = []
|
||||
|
||||
if stats["deleted"]:
|
||||
if stats["added"] > 0:
|
||||
prompts.append(f"{stats['added']} {_pluralize_entry(stats['added'])} added")
|
||||
stats["modified"] -= stats["added"]
|
||||
|
||||
if stats["deleted"] > 0:
|
||||
prompts.append(
|
||||
f"{stats['deleted']} {_pluralize_entry(stats['deleted'])} deleted"
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue