Fix issue with combine_notes

This commit is contained in:
Timmy Welch 2022-11-24 01:24:15 -08:00
parent 1cbed64299
commit c5a5fc8bdb
No known key found for this signature in database
2 changed files with 3 additions and 2 deletions

View File

@ -38,8 +38,8 @@ class UtilsVars:
def combine_notes(existing_notes: str | None, new_notes: str | None, split: str) -> str:
split_notes, _, untouched_notes = (existing_notes or "").rpartition(split)
if split_notes:
split_notes, split_str, untouched_notes = (existing_notes or "").rpartition(split)
if split_notes or split_str:
return (split_notes + (new_notes or "")).strip()
else:
return (untouched_notes + "\n" + (new_notes or "")).strip()

View File

@ -86,6 +86,7 @@ combine_values = [
(None, "english", "en", "english"),
("hello", "", "en", "hello"),
("hello", None, "en", "hello"),
("hello", "hello", "hel", "hello"),
]