[tasks] Remove in-progress tag to stop

This commit is contained in:
2024-10-15 15:11:03 -04:00
parent b1eac1454b
commit 8fb2fac47f
2 changed files with 7 additions and 3 deletions

View File

@ -348,11 +348,16 @@ def todoist_scrobble_task(todoist_task: dict, user_id: int) -> Scrobble:
task = Task.find_or_create(title)
in_progress_scrobble = Scrobble.objects.filter(
in_progress=True, log__todoist_id=todoist_task.get("todoist_id")
in_progress=True,
log__todoist_id=todoist_task.get("todoist_id"),
task=task,
).first()
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,

View File

@ -60,10 +60,9 @@ def todoist_webhook(request):
if not user_id:
user_id = 1
scrobble = None
if "completed" in todoist_task["todoist_event"]:
scrobble = todoist_scrobble_task_finish(todoist_task, user_id)
elif "inprogress" in todoist_task["todoist_label_list"]:
else:
scrobble = todoist_scrobble_task(todoist_task, user_id)
if not scrobble: