Minor fix for status

Signed-off-by: anasty17 <e.anastayyar@gmail.com>
This commit is contained in:
anasty17 2024-03-14 02:21:25 +02:00
parent 3e1f623872
commit c426fc8904

View File

@ -53,7 +53,7 @@ STATUSES = {
async def getTaskByGid(gid: str):
async with task_dict_lock:
for tk in list(task_dict.values()):
for tk in task_dict.values():
if hasattr(tk, "seeding"):
await sync_to_async(tk.update)
if tk.gid() == gid:
@ -65,28 +65,28 @@ def getSpecificTasks(status, userId):
if status == "All":
if userId:
return [
tk for tk in list(task_dict.values()) if tk.listener.userId == userId
tk for tk in task_dict.values() if tk.listener.userId == userId
]
else:
return list(task_dict.values())
elif userId:
return [
tk
for tk in list(task_dict.values())
for tk in task_dict.values()
if tk.listener.userId == userId
and (
(st := tk.status() == status)
(st := tk.status()) and st == status
or status == MirrorStatus.STATUS_DOWNLOADING
and st not in list(STATUSES.values())
and st not in STATUSES.values()
)
]
else:
return [
tk
for tk in list(task_dict.values())
if (st := tk.status() == status)
for tk in task_dict.values()
if (st := tk.status()) and st == status
or status == MirrorStatus.STATUS_DOWNLOADING
and st not in list(STATUSES.values())
and st not in STATUSES.values()
]