From e7eba29effcfd051a9501c94cc712afb68f7387d Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Thu, 15 Oct 2026 17:22:16 +0200 Subject: coaching: add hint if no coachees are available --- src/coaching.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/coaching.js b/src/coaching.js index 2fd2429..27ce2ea 100644 --- a/src/coaching.js +++ b/src/coaching.js @@ -32,12 +32,27 @@ async function loadGroup() { li.appendChild(i); } - const graduations = await Promise.all(graduationPromises); + await Promise.all(graduationPromises); + + const coaches = new Set(); + const coachees = []; for (const li of listEntries) { - const student = li.student; - if (!student.graduation.coaches.includes(name)) continue; + for (const coach of li.student.graduation.coaches) { + coaches.add(coach); + } + if (!li.student.graduation.coaches.includes(name)) continue; + coachees.push(li); + } + if (coachees.length === 0) { + ul.innerHTML = ` +
  • Du hast keine Coachees
  • +
  • Coaches der Klasse: ${Array.from(coaches)}
  • `; + } + + for (const li of coachees) { + const student = li.student; const n = document.createElement("span"); n.classList.add("group-member-name"); n.innerHTML = `${student.name}`; -- cgit v1.2.3