From b1eac1454be0bf80d7ac900c1e3b3ee384e5e569 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Tue, 15 Oct 2024 15:07:43 -0400 Subject: [PATCH] [tasks] Don't create new scrobbles for in progress tasks --- vrobbler/apps/scrobbles/scrobblers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vrobbler/apps/scrobbles/scrobblers.py b/vrobbler/apps/scrobbles/scrobblers.py index f4ed71e..52435bf 100644 --- a/vrobbler/apps/scrobbles/scrobblers.py +++ b/vrobbler/apps/scrobbles/scrobblers.py @@ -347,6 +347,11 @@ def todoist_scrobble_task(todoist_task: dict, user_id: int) -> Scrobble: title = " ".join([prefix.capitalize(), suffix.capitalize()]) task = Task.find_or_create(title) + in_progress_scrobble = Scrobble.objects.filter( + in_progress=True, log__todoist_id=todoist_task.get("todoist_id") + ).first() + if in_progress_scrobble: + return in_progress_scrobble # TODO Should use updated_at from TOdoist, but parsing isn't working scrobble_dict = {