From d01da73bc37d40474e41e81177a2bab0c67a6dda Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sun, 5 Jul 2026 19:18:52 +0200 Subject: cockpit: update to latest code changes --- cockpit/index.html | 5 ----- cockpit/js/cockpit.js | 25 ++++++++++++++----------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/cockpit/index.html b/cockpit/index.html index ddf8005..dab2c89 100644 --- a/cockpit/index.html +++ b/cockpit/index.html @@ -9,11 +9,6 @@ - -
`${student.name} ${student.getRealGroups().join(", ")}`, + (student) => `${student.name} ${student.getGroup()}`, loadStudent ); } @@ -69,20 +69,19 @@ function pointClickHandler(color) { textareaDiv.style.display = "block"; textarea.focus(); - // Can not use string interpolation because of Moodle's firstname filter. - const coach = firstname + " " + lastname; + const coach = name; let submit = function() { let change; switch (color) { case "green": - change = GraduationChange.newGreenPointChange(student, textarea.value, coach); + change = GraduationChange.newGreenPointChange(textarea.value, coach); break; case "orange": - change = GraduationChange.newOrangePointChange(student, textarea.value, coach); + change = GraduationChange.newOrangePointChange(textarea.value, coach); break; case "red": - change = GraduationChange.newRedPointChange(student, textarea.value, coach); + change = GraduationChange.newRedPointChange(textarea.value, coach); break; default: alert("Invalid color"); @@ -106,7 +105,11 @@ function pointClickHandler(color) { } async function fetchAndUpdateStudentInfo() { - student.graduation = await fetchGraduation(student); + if (isTeacher) + student.graduation = await fetchGraduation(student); + else + student.graduation = await fetchPublicGraduation(student); + updateStudentInfo(); } @@ -293,6 +296,6 @@ async function initCockpit() { window.onload = function() { isTeacher = getIsTeacher(); DEFAULT_STUDENT_ICON = document.getElementById("student-info-icon").src; - [firstname, lastname] = getFirstAndLastname(); + name = getName(); initCockpit(); } -- cgit v1.2.3