[tasks] We only care about in-progress for scrobbling

This commit is contained in:
2024-10-15 15:23:15 -04:00
parent 470eb0778a
commit de6e9ce2d6
2 changed files with 9 additions and 7 deletions

View File

@ -353,6 +353,14 @@ def todoist_scrobble_task(todoist_task: dict, user_id: int) -> Scrobble:
title = " ".join([prefix.capitalize(), suffix.capitalize()])
task = Task.find_or_create(title)
# is_complete = "completed" in todoist_task["todoist_event"]
is_no_longer_in_progress = (
"inprogress" not in todoist_task["todoist_label_list"]
)
if is_no_longer_in_progress:
scrobble = todoist_scrobble_task_finish(todoist_task, user_id)
in_progress_scrobble = Scrobble.objects.filter(
in_progress=True,
log__todoist_id=todoist_task.get("todoist_id"),
@ -361,9 +369,6 @@ def todoist_scrobble_task(todoist_task: dict, user_id: int) -> Scrobble:
if in_progress_scrobble:
return in_progress_scrobble
if "inprogress" not in todoist_task["todoist_label_list"]:
return todoist_scrobble_task_finish(todoist_task, user_id)
# TODO Should use updated_at from TOdoist, but parsing isn't working
scrobble_dict = {
"user_id": user_id,