diff --git a/vrobbler/apps/scrobbles/scrobblers.py b/vrobbler/apps/scrobbles/scrobblers.py index 4099947..641236a 100644 --- a/vrobbler/apps/scrobbles/scrobblers.py +++ b/vrobbler/apps/scrobbles/scrobblers.py @@ -354,19 +354,17 @@ def todoist_scrobble_task(todoist_task: dict, user_id: int) -> Scrobble: 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"), task=task, ).last() - if in_progress_scrobble: + is_no_longer_in_progress = ( + "inprogress" not in todoist_task["todoist_label_list"] + ) + if in_progress_scrobble + if is_no_longer_in_progress: + scrobble = todoist_scrobble_task_finish(todoist_task, user_id) return in_progress_scrobble # TODO Should use updated_at from TOdoist, but parsing isn't working