diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-07-12 09:33:58 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-07-12 09:33:58 +0200 |
| commit | 1a291fb37fdf0e5a1b2a54825e5af7c5e986f00f (patch) | |
| tree | 3349f89ce4412b63c403411045185c80ba50a6bf /js/student-common.js | |
| parent | b39d7dd42c75b096aa88ffc07ae78f1445c8e588 (diff) | |
| download | bycs-sol-1a291fb37fdf0e5a1b2a54825e5af7c5e986f00f.tar.gz bycs-sol-1a291fb37fdf0e5a1b2a54825e5af7c5e986f00f.zip | |
implment observation period handling
Diffstat (limited to 'js/student-common.js')
| -rw-r--r-- | js/student-common.js | 22 |
1 files changed, 21 insertions, 1 deletions
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) { |
