diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2026-08-05 11:51:51 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2026-08-05 11:51:51 +0200 |
| commit | 582df8885a3573a728394b473b826616f8969316 (patch) | |
| tree | 9c21db03f4fbfd9956ee398e0d9194ebfa5b3234 /src/group.js | |
| parent | 46ac53e11b49a7f9cdb92c3559b05f41ce90122f (diff) | |
| download | bycs-sol-582df8885a3573a728394b473b826616f8969316.tar.gz bycs-sol-582df8885a3573a728394b473b826616f8969316.zip | |
convert a lot of js to typescript and use a single graduation DB
Diffstat (limited to 'src/group.js')
| -rw-r--r-- | src/group.js | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/src/group.js b/src/group.js deleted file mode 100644 index d52707b..0000000 --- a/src/group.js +++ /dev/null @@ -1,57 +0,0 @@ -import { getCourseParticipantsUrl } from "./utils-ENV.js"; -import { fetchStudents } from "./student-ENV.js"; - -/** - * Class to represent a Group of Students. - */ -class Group { - constructor(name, students) { - this.name = name; - if (!students) { - this.students = []; - } - } - - setStudents(students) { - this.students = students; - } - - addStudent(student) { - this.students.push(student); - } - - async getStudents() { - return this.students; - } -} - -const groups = new Map(); - -function buildGroups(students) { - for (const student of students) { - let group = groups.get(student.group); - - if (!group) { - group = new Group(student.group); - groups.set(student.group, group); - } - - group.addStudent(student); - } -} - -/** - * Fetch all Groups and return them as a map. - */ -async function fetchGroups() { - if (groups.size) { - return groups; - } - - // Fetch all students and build the groups from them - const students = await fetchStudents(); - buildGroups(students); - return groups; -} - -export { Group, buildGroups, fetchGroups }; |
