소스 검색

[tasks] Don't create new scrobbles for in progress tasks

Colin Powell 8 달 전
부모
커밋
b1eac1454b
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      vrobbler/apps/scrobbles/scrobblers.py

+ 5 - 0
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 = {