diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-09-25 19:35:24 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-09-25 21:00:12 +0200 |
| commit | b3d770918fcb181e01a7cfeb1bc13a0ec55c22c5 (patch) | |
| tree | d5dcc728c1f081485da291b513c9f6842d1afdda /src/coaching.js | |
| parent | 576fe6814be88534f5fe4a8e4703b909b1800f5f (diff) | |
| download | bycs-sol-b3d770918fcb181e01a7cfeb1bc13a0ec55c22c5.tar.gz bycs-sol-b3d770918fcb181e01a7cfeb1bc13a0ec55c22c5.zip | |
coaching: link to each student's cockpit
Diffstat (limited to 'src/coaching.js')
| -rw-r--r-- | src/coaching.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/coaching.js b/src/coaching.js index 8b97784..2fd2429 100644 --- a/src/coaching.js +++ b/src/coaching.js @@ -1,10 +1,12 @@ import { fetchStudents } from "./student-ENV.ts"; -import { getName } from "./utils-ENV.js"; +import { getName, getActivityUrl } from "./utils-ENV.js"; let name; async function loadGroup() { + const cockpitUrlPromise = getActivityUrl("Cockpit"); + const students = await fetchStudents(); const graduationPromises = []; document.getElementById("group-content").style.display = "block"; @@ -34,13 +36,17 @@ async function loadGroup() { for (const li of listEntries) { const student = li.student; - if (!student.graduation.coaches.includes(name)) - continue; + if (!student.graduation.coaches.includes(name)) continue; const n = document.createElement("span"); n.classList.add("group-member-name"); n.innerHTML = `${student.name}`; li.appendChild(n); + n.addEventListener("click", async function () { + const cockpitUrl = new URL(await cockpitUrlPromise, window.location.origin); + cockpitUrl.searchParams.append("userToLoad", student.id); + window.location = cockpitUrl; + }); for (const col of ["green", "orange", "red"]) { const s = document.createElement("span"); |
