Skip to content
Snippets Groups Projects
Commit 71f443eb authored by permcu's avatar permcu
Browse files

Assure bundle-card shows only unique subjects, teachers and rooms

parent 1caf811e
No related branches found
No related tags found
1 merge request!50Resolve "Implement bundled courses/lessons"
......@@ -36,21 +36,23 @@ export default defineComponent({
return this.bundle.courses || this.bundle.lessons;
},
subjects() {
return this.children.flatMap(child => child.subject || {
const subjects = this.children.flatMap(child => child.subject || {
name: "",
colourFg: "#000000",
colourBg: "#e6e6e6",
}
);
return [...new Set(subjects)];
},
teachers() {
return this.children.flatMap(child => child.teachers);
const teachers = this.children.flatMap(child => child.teachers);
return [...new Set(teachers)];
},
rooms() {
const rooms = this.bundle.courses
? this.bundle.courses.map(course => course.defaultRoom)
: this.bundle.lessons.flatMap(lesson => lesson.rooms);
return rooms.filter(n => n);
return [...new Set(rooms.filter(room => room))];
},
colorFg() {
if (this.subjects.length === 1) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment