blob: 56dab43fbca995a8e9a74bd43d836d6df54ac3cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
import type { Graduation } from "./graduation-common.ts";
/**
* Class to represent Students.
*/
export class Student {
id: number;
name: string;
graduation: Graduation | null = null;
constructor(id: number, name: string) {
this.id = id;
this.name = name;
}
/**
static async fetchById(id: number) {
let name = "";
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;
break;
}
return new Student(id, name);
}
*/
}
|