diff --git a/app/templates/dashboard.html b/app/templates/dashboard.html
index 8fcd4fa..bc63cfc 100644
--- a/app/templates/dashboard.html
+++ b/app/templates/dashboard.html
@@ -97,7 +97,7 @@
'bg-green-900/50 text-green-400': b.status==='active',
'bg-gray-800 text-gray-500': b.status==='completed'||b.status==='archived'
}"
- x-text="Math.round(((b.tasks||[]).filter(t=>t.status==='done').length/Math.max(1,(b.tasks||[]).length))*100)+'%'">
+ x-text="Math.round((b.tasks ? b.tasks.filter(t=>t.status==='done').length/Math.max(1,b.tasks.length) : (b.done_count||0)/Math.max(1,b.task_count||1))*100)+'%'">
@@ -471,6 +471,12 @@ document.addEventListener('alpine:init', () => {
},
async select(id) {
this.activeId = id;
+ // fetch full board detail (includes tasks array) if not yet loaded
+ const idx = this.list.findIndex(b=>b.board_id===id);
+ if(idx>=0 && !this.list[idx].tasks) {
+ const r = await fetch(`/api/v1/boards/${id}`).then(r=>r.json());
+ this.list[idx] = {...this.list[idx], ...r};
+ }
},
openNewBoard() { /* TODO */ },
openNewTask(status) { /* TODO */ },
@@ -484,7 +490,7 @@ document.addEventListener('alpine:init', () => {
const idx = this.list.findIndex(b=>b.board_id===task.board_id);
if(idx>=0){
const r=await fetch(`/api/v1/boards/${task.board_id}`).then(r=>r.json());
- this.list[idx]=r.board;
+ this.list[idx]={...this.list[idx], ...r};
}
}
});