aboutsummaryrefslogtreecommitdiff
path: root/src/coaching.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/coaching.js')
-rw-r--r--src/coaching.js21
1 files 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 = `
+ <li>Du hast keine Coachees</li>
+ <li>Coaches der Klasse: ${Array.from(coaches)}</li>`;
+ }
+
+ for (const li of coachees) {
+ const student = li.student;
const n = document.createElement("span");
n.classList.add("group-member-name");
n.innerHTML = `${student.name}`;