[tasks] Fix emacs not updating or completing

This commit is contained in:
2025-10-29 17:12:48 -04:00
parent bdfbd3e5c0
commit cd60ac6387
4 changed files with 36 additions and 16 deletions

View File

@ -39,15 +39,22 @@ class TaskLogData(BaseLogData):
def notes_as_str(self) -> str:
"""Return formatted notes with line breaks and no keys"""
note_block = ""
if isinstance(self.notes, list):
note_block = "</br>".join(self.notes)
labels_str = ""
if self.labels:
labels_str = ", ".join(self.labels)
# DEPRECATED ... we don't store notes in dicts anymore
if isinstance(self.notes, dict):
for id, content in self.notes.items():
note_block += content + "</br>"
return note_block
lines = []
if self.notes:
for note in self.notes:
if isinstance(note, dict):
timestamp, note_text = next(iter(note.items()))
# Flatten newlines and clean whitespace
note_text = " ".join(note_text.strip().split())
lines.append(f"{timestamp}: {note_text} [{labels_str}]")
if isinstance(note, str):
lines.append(note)
return "\n".join(lines)
class Task(LongPlayScrobblableMixin):
@ -82,7 +89,7 @@ class Task(LongPlayScrobblableMixin):
def subtitle_for_user(self, user_id):
scrobble = self.scrobbles(user_id).first()
return scrobble.logdata.title or ""
return scrobble.logdata.title or scrobble.log.get("title")
@classmethod
def find_or_create(cls, title: str) -> "Task":