diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-06-13 13:04:07 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-06-13 13:04:07 +0200 |
| commit | 4882c5ca3a65075e03595588ef3780a36bc74b15 (patch) | |
| tree | 07aa2a276cd87a8e192147440411c1f51d8aa624 | |
| parent | 9fbd21ff6bf97b9ce77cb78f420abd951b8aaf27 (diff) | |
| download | bycs-sol-4882c5ca3a65075e03595588ef3780a36bc74b15.tar.gz bycs-sol-4882c5ca3a65075e03595588ef3780a36bc74b15.zip | |
move generic js into root
| -rw-r--r-- | cockpit/js/cockpit.js | 10 | ||||
| -rw-r--r-- | js/config.js (renamed from cockpit/js/config.js) | 0 | ||||
| -rw-r--r-- | js/database.js (renamed from cockpit/js/database.js) | 0 | ||||
| -rw-r--r-- | js/graduation-common.js (renamed from cockpit/js/graduation-common.js) | 0 | ||||
| -rw-r--r-- | js/graduation-mock.js (renamed from cockpit/js/graduation-mock.js) | 0 | ||||
| -rw-r--r-- | js/graduation-prod.js (renamed from cockpit/js/graduation-prod.js) | 0 | ||||
| -rw-r--r-- | js/mock.js (renamed from cockpit/js/mock.js) | 0 | ||||
| -rw-r--r-- | js/selection.js (renamed from cockpit/js/selection.js) | 0 | ||||
| -rw-r--r-- | js/student-common.js (renamed from cockpit/js/student-common.js) | 16 | ||||
| -rw-r--r-- | js/student-mock.js (renamed from cockpit/js/student-mock.js) | 0 | ||||
| -rw-r--r-- | js/student-prod.js (renamed from cockpit/js/student-prod.js) | 0 | ||||
| -rw-r--r-- | js/utils-mock.js (renamed from utils-mock.js) | 0 | ||||
| -rw-r--r-- | js/utils-prod.js (renamed from utils-prod.js) | 0 |
13 files changed, 18 insertions, 8 deletions
diff --git a/cockpit/js/cockpit.js b/cockpit/js/cockpit.js index 2babcea..c45682f 100644 --- a/cockpit/js/cockpit.js +++ b/cockpit/js/cockpit.js @@ -1,17 +1,17 @@ import { fetchSubjectsMock as fetchSubjects, fetchProgressMock as fetchProgress, -} from "./mock.js"; +} from "../../js/mock.js"; import { GraduationChange, fetchGraduation, submitGraduationChange -} from "./graduation-ENV.js"; +} from "../../js/graduation-ENV.js"; -import { Student, fetchStudent, fetchStudents } from "./student-ENV.js"; -import { isTeacher as getIsTeacher } from "../../utils-ENV.js"; -import { initSelection } from "./selection.js"; +import { Student, fetchStudent, fetchStudents } from "../../js/student-ENV.js"; +import { isTeacher as getIsTeacher } from "../../js/utils-ENV.js"; +import { initSelection } from "../../js/selection.js"; let isTeacher; let firstname; diff --git a/cockpit/js/config.js b/js/config.js index 2beb91b..2beb91b 100644 --- a/cockpit/js/config.js +++ b/js/config.js diff --git a/cockpit/js/database.js b/js/database.js index 3297a11..3297a11 100644 --- a/cockpit/js/database.js +++ b/js/database.js diff --git a/cockpit/js/graduation-common.js b/js/graduation-common.js index 4716e6d..4716e6d 100644 --- a/cockpit/js/graduation-common.js +++ b/js/graduation-common.js diff --git a/cockpit/js/graduation-mock.js b/js/graduation-mock.js index 9f67185..9f67185 100644 --- a/cockpit/js/graduation-mock.js +++ b/js/graduation-mock.js diff --git a/cockpit/js/graduation-prod.js b/js/graduation-prod.js index de7cbf4..de7cbf4 100644 --- a/cockpit/js/graduation-prod.js +++ b/js/graduation-prod.js diff --git a/cockpit/js/mock.js b/js/mock.js index a189a11..a189a11 100644 --- a/cockpit/js/mock.js +++ b/js/mock.js diff --git a/cockpit/js/selection.js b/js/selection.js index a1da244..a1da244 100644 --- a/cockpit/js/selection.js +++ b/js/selection.js diff --git a/cockpit/js/student-common.js b/js/student-common.js index 1f4d083..930c373 100644 --- a/cockpit/js/student-common.js +++ b/js/student-common.js @@ -3,15 +3,19 @@ import { getUserIconUrl, getCourseParticipantsUrl } from "./config.js"; * Class to represent Students. */ class Student { - constructor(id, name, group) { + constructor(id, name, groups) { this.id = id; this.name = name; - this.group = group; + this.groups = groups; } async getIconUrl() { return await getUserIconUrl(this.id); } + + getGroupName() { + return `g${this.id}${this.name.replace(' ', '')}`; + } } async function fetchStudent(idFilter, nameFilter, groupFilter) { @@ -19,12 +23,18 @@ async function fetchStudent(idFilter, nameFilter, groupFilter) { return students[0]; } +// Cache the fetched students. +let students = []; + const idRegex = /id=(\d+)/; async function fetchStudents(idFilter, nameFilter, groupFilter) { + if (students.size) { + return students; + } + const res = await fetch(getCourseParticipantsUrl()); const doc = new DOMParser().parseFromString(await res.text(), "text/html"); const table = doc.querySelector("tbody"); - let students = []; table.querySelectorAll("tr").forEach(row => { if (row.classList.contains("emptyrow")) return; diff --git a/cockpit/js/student-mock.js b/js/student-mock.js index 0ea12ea..0ea12ea 100644 --- a/cockpit/js/student-mock.js +++ b/js/student-mock.js diff --git a/cockpit/js/student-prod.js b/js/student-prod.js index f9c430c..f9c430c 100644 --- a/cockpit/js/student-prod.js +++ b/js/student-prod.js diff --git a/utils-mock.js b/js/utils-mock.js index 4f5348d..4f5348d 100644 --- a/utils-mock.js +++ b/js/utils-mock.js diff --git a/utils-prod.js b/js/utils-prod.js index 1dd7e8e..1dd7e8e 100644 --- a/utils-prod.js +++ b/js/utils-prod.js |
