added progress bar for competencies
This commit is contained in:
@@ -81,6 +81,22 @@ function countByState(items) {
|
||||
}, {});
|
||||
}
|
||||
|
||||
async function updateProgress(items) {
|
||||
const total = items.length;
|
||||
const completed = items.filter(i => i.state === "completed").length;
|
||||
|
||||
|
||||
const percent = total === 0 ? 0 : Math.round((completed / total) * 100);
|
||||
|
||||
console.log(`Progress: ${percent}% (${completed}/${total})`);
|
||||
|
||||
const fill = document.getElementById("progress-fill");
|
||||
const label = document.getElementById("progress-label");
|
||||
|
||||
if (fill) fill.style.width = `${percent}%`;
|
||||
if (label) label.textContent = `${percent}% completed`;
|
||||
}
|
||||
|
||||
function createCard(item) {
|
||||
const card = document.createElement("div");
|
||||
card.className = "kanban-card";
|
||||
@@ -158,8 +174,9 @@ function renderBoard(items) {
|
||||
async function loadBoard() {
|
||||
const res = await fetch("/api/competencies/items");
|
||||
const items = await res.json();
|
||||
|
||||
updateProgress(items);
|
||||
renderBoard(items);
|
||||
populateMobileControls(items);
|
||||
}
|
||||
|
||||
loadBoard();
|
||||
|
||||
Reference in New Issue
Block a user