diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-08-05 11:58:50 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-08-05 11:59:56 +0200 |
| commit | d35e03f0b07d1af3fecd51cd4ca42a76c300db23 (patch) | |
| tree | 92562e06ade3a2ac30e5ce39b8442d980b2fad08 /src/student-prod.ts | |
| parent | 6c2bffd297bdfaf4e95a8f0620cf0349d3d3bb78 (diff) | |
| download | bycs-sol-d35e03f0b07d1af3fecd51cd4ca42a76c300db23.tar.gz bycs-sol-d35e03f0b07d1af3fecd51cd4ca42a76c300db23.zip | |
format: run prettier
Diffstat (limited to 'src/student-prod.ts')
| -rw-r--r-- | src/student-prod.ts | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/student-prod.ts b/src/student-prod.ts index 24ac869..67379d9 100644 --- a/src/student-prod.ts +++ b/src/student-prod.ts @@ -1,20 +1,20 @@ import type { Graduation } from "./graduation-common.ts"; import { Student } from "./student-common.ts"; -import { getUserIconUrl, getCourseParticipantsUrl } from "./utils-prod.js" +import { getUserIconUrl, getCourseParticipantsUrl } from "./utils-prod.js"; import { fetchGraduation } from "./graduation-prod.ts"; declare module "./student-common.ts" { - interface Student { - getGraduation(): Promise<Graduation>; - getIconUrl(): Promise<string>; - } + interface Student { + getGraduation(): Promise<Graduation>; + getIconUrl(): Promise<string>; + } } Student.prototype.getGraduation = function () { - return fetchGraduation(this); + return fetchGraduation(this); }; Student.prototype.getIconUrl = function () { - return getUserIconUrl(this.id); + return getUserIconUrl(this.id); }; // Cache the fetched students. @@ -26,9 +26,8 @@ async function _fetchStudents() { const doc = new DOMParser().parseFromString(await res.text(), "text/html"); const table = doc.querySelector("tbody")!; const fetchedStudents: Array<Student> = []; - table.querySelectorAll("tr").forEach(row => { - if (row.classList.contains("emptyrow")) - return; + table.querySelectorAll("tr").forEach((row) => { + if (row.classList.contains("emptyrow")) return; const roleCell = row.querySelector(".c4")!; // TODO(muhq): Is this locale dependent? @@ -39,10 +38,8 @@ async function _fetchStudents() { const nameCell = row.querySelector<HTMLElement>(".c1")!; let name; const c = nameCell.firstChild!.firstChild! as HTMLElement; - if (c.tagName == "SPAN") - name = c.title; - else - name = nameCell.innerText; + if (c.tagName == "SPAN") name = c.title; + else name = nameCell.innerText; const profileUrl = nameCell.querySelector<HTMLAnchorElement>("a.aabtn")!.href; const match = idRegex.exec(profileUrl); @@ -76,10 +73,12 @@ async function fetchStudents(idFilter?: number, nameFilter?: string, groupFilter } } - return students.filter((s) => - (typeof idFilter === "undefined" || s.id === idFilter) && - (typeof nameFilter === "undefined" || s.name.includes(nameFilter)) && - (typeof groupFilter === "undefined" || s.group.includes(groupFilter))); + return students.filter( + (s) => + (typeof idFilter === "undefined" || s.id === idFilter) && + (typeof nameFilter === "undefined" || s.name.includes(nameFilter)) && + (typeof groupFilter === "undefined" || s.group.includes(groupFilter)), + ); } async function fetchStudent(idFilter: number, nameFilter: string, groupFilter: string) { |
