import type { Graduation } from "./graduation-common.ts"; /** * Class to represent Students. */ export class Student { id: number; name: string; group: string; graduation: Graduation | null = null; constructor(id: number, name: string, group: string) { this.id = id; this.name = name; this.group = group; } getGroup() { return this.group; } /** static async fetchById(id: number) { 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); } */ }