From d35e03f0b07d1af3fecd51cd4ca42a76c300db23 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 5 Aug 2026 11:58:50 +0200 Subject: format: run prettier --- src/student-prod.ts | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'src/student-prod.ts') 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; - getIconUrl(): Promise; - } + interface Student { + getGraduation(): Promise; + getIconUrl(): Promise; + } } 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 = []; - 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(".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("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) { -- cgit v1.2.3