aboutsummaryrefslogtreecommitdiff
path: root/js/group.js
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2026-07-01 16:27:12 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2026-07-01 16:28:00 +0200
commit4a1f493d84330d6319a623e2eed126d9f74f0c9b (patch)
treedf4fe0caf51ca2e9e0fcbf7d98cefa10e8188312 /js/group.js
parente189096ad58993ac00f440ccf5dacf4b760b95a7 (diff)
downloadbycs-sol-4a1f493d84330d6319a623e2eed126d9f74f0c9b.tar.gz
bycs-sol-4a1f493d84330d6319a623e2eed126d9f74f0c9b.zip
remove individual student groups
Diffstat (limited to 'js/group.js')
-rw-r--r--js/group.js35
1 files changed, 7 insertions, 28 deletions
diff --git a/js/group.js b/js/group.js
index 7b3dfd1..f9c31a2 100644
--- a/js/group.js
+++ b/js/group.js
@@ -26,27 +26,17 @@ class Group {
}
let groups = new Map();
-let bycsGroups = new Map();
function buildGroups(students) {
for (const student of students) {
- for (const groupName of student.groups) {
- let group = groups.get(groupName);
+ let group = groups.get(student.group);
- if (!group) {
- group = new Group(groupName);
- groups.set(groupName, group);
- if (groupName != student.getGroupName()) {
- bycsGroups.set(groupName, group);
- }
- }
-
- group.addStudent(student);
-
- // Create the individual student group
- const sGroupName = student.getGroupName();
- groups.set(sGroupName, new Group(sGroupName, [student]));
+ if (!group) {
+ group = new Group(student.group);
+ groups.set(student.group, group);
}
+
+ group.addStudent(student);
}
}
@@ -64,15 +54,4 @@ async function fetchGroups() {
return groups;
}
-async function fetchBycsGroups() {
- if (bycsGroups.size) {
- return bycsGroups;
- }
-
- // Fetch all students and build the groups from them
- const students = await fetchStudents();
- buildGroups(students);
- return bycsGroups;
-}
-
-export { Group, buildGroups, fetchGroups, fetchBycsGroups };
+export { Group, buildGroups, fetchGroups };