From 1a291fb37fdf0e5a1b2a54825e5af7c5e986f00f Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sun, 12 Jul 2026 09:33:58 +0200 Subject: implment observation period handling --- js/student-common.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'js/student-common.js') diff --git a/js/student-common.js b/js/student-common.js index c89b818..778ff8d 100644 --- a/js/student-common.js +++ b/js/student-common.js @@ -1,4 +1,4 @@ -import { getUserIconUrl, getCourseParticipantsUrl } from "./config.js"; +import { getCourseId, getUserIconUrl, getCourseParticipantsUrl } from "./config.js"; import { fetchGraduation } from "./graduation-common.js"; /** * Class to represent Students. @@ -27,6 +27,26 @@ class Student { } return this.graduation; } + + static async fetchById(id) { + let name = ""; + let group = ""; + + const res = await fetch(`/user/view.php?id=${id}&course=${getCourseId()}`); + const doc = new DOMParser().parseFromString(await res.text(), "text/html"); + + name = doc.querySelector("div.page-header-headings > h2").textContent; + + const cards = doc.querySelectorAll("div.card-body dl"); + for (const card of cards) { + if (card.querySelector("dt").textContent !== "Gruppe") + continue; + group = card.querySelector("dd > a").textContent; + break; + } + + return new Student(id, name, group); + } } async function fetchStudent(idFilter, nameFilter, groupFilter) { -- cgit v1.2.3