diff --git a/frontend/src/routes/task/Index.svelte b/frontend/src/routes/task/Index.svelte index c536f0f..0cb7461 100644 --- a/frontend/src/routes/task/Index.svelte +++ b/frontend/src/routes/task/Index.svelte @@ -14,8 +14,9 @@ let map = $state({}); let hidden = $state({}); - async function changeState(tid,state){ - const task = tasks[tid]; + async function changeState(idx,state){ + const task = tasks[idx]; + const tid = task.id; const prj = projects[task.project_id]; const stat = Object.keys(prj.allowed_states).find(k => prj.allowed_states[k] === state); const url = api(`task/${tid}`); @@ -25,18 +26,18 @@ body : JSON.stringify({status:stat}) }); if (resp.ok){ - tasks[tid] = await resp.json(); + tasks[idx] = await resp.json(); } else { error(resp); } } - function abort(tid){ - changeState(tid,'CANCELLED'); + function abort(idx){ + changeState(idx,'CANCELLED'); } - function complete(tid){ - changeState(tid,'COMPLETE'); + function complete(idx){ + changeState(idx,'COMPLETE'); } function edit(tid){ @@ -81,16 +82,16 @@ } } - function open(tid){ - changeState(tid,'OPEN'); + function open(idx){ + changeState(idx,'OPEN'); } - function postpone(tid){ - changeState(tid,'PENDING'); + function postpone(idx){ + changeState(idx,'PENDING'); } - function start(tid){ - changeState(tid,'STARTED'); + function start(idx){ + changeState(idx,'STARTED'); } onMount(load); @@ -115,7 +116,7 @@
- {#each tasks as task (task.id)} + {#each tasks as task,idx} {#if task.status > 10 && task.status < 60 && !task.no_index && projects[task.project_id]?.status < 60 && !hidden[task.id]}