Bläddra i källkod

[task] Ooops, add task id

Colin Powell 8 månader sedan
förälder
incheckning
59d681dc00
2 ändrade filer med 4 tillägg och 5 borttagningar
  1. 2 4
      vrobbler/apps/scrobbles/scrobblers.py
  2. 2 1
      vrobbler/apps/tasks/webhooks.py

+ 2 - 4
vrobbler/apps/scrobbles/scrobblers.py

@@ -324,7 +324,7 @@ def todoist_scrobble_update_task(
     scrobble = Scrobble.objects.filter(
         in_progress=True,
         user_id=user_id,
-        log__task_id=todoist_note.get("task_id"),
+        log__todoist_id=todoist_note.get("task_id"),
     ).first()
 
     if not scrobble:
@@ -339,9 +339,7 @@ def todoist_scrobble_update_task(
         return
 
     existing_notes = scrobble.log.get("notes", {})
-    existing_notes[todoist_note.get("todoist_id")] = todoist_note.get(
-        "content"
-    )
+    existing_notes[todoist_note.get("todoist_id")] = todoist_note.get("notes")
     scrobble.log["notes"] = existing_notes
     scrobble.save(update_fields=["log"])
     logger.info(

+ 2 - 1
vrobbler/apps/tasks/webhooks.py

@@ -61,7 +61,8 @@ def todoist_webhook(request):
     if is_note_type and is_added:
         task_data = event_data.get("item", {})
         todoist_note = {
-            "todoist_id": task_data.get("id"),
+            "task_id": event_data.get("item_id"),
+            "todoist_id": event_data.get("id"),
             "todoist_label_list": task_data.get("labels"),
             "todoist_type": todoist_type,
             "todoist_event": todoist_event,