aboutsummaryrefslogtreecommitdiff
path: root/src/coaching.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/coaching.js')
-rw-r--r--src/coaching.js12
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");