🐛 Correctly copy objects
- Fixes timetable data corruption on timetable group change
This commit is contained in:
@ -155,7 +155,7 @@ export const parsedTimetable = computed(() => {
|
|||||||
return timetable.value.data.map((day) => {
|
return timetable.value.data.map((day) => {
|
||||||
const parsedDay = [];
|
const parsedDay = [];
|
||||||
for (const lesson of day) {
|
for (const lesson of day) {
|
||||||
let usedLesson = lesson;
|
let usedLesson = { ...lesson };
|
||||||
// Check if lesson has multiple options
|
// Check if lesson has multiple options
|
||||||
// (timetable groups)
|
// (timetable groups)
|
||||||
if (Array.isArray(lesson)) {
|
if (Array.isArray(lesson)) {
|
||||||
@ -171,7 +171,7 @@ export const parsedTimetable = computed(() => {
|
|||||||
length: lesson[0].length || 1,
|
length: lesson[0].length || 1,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
usedLesson = matchingLesson;
|
usedLesson = { ...matchingLesson };
|
||||||
}
|
}
|
||||||
// Duplicate the lesson if its length is > 1 for it
|
// Duplicate the lesson if its length is > 1 for it
|
||||||
// to show up multiple times in the timetable view
|
// to show up multiple times in the timetable view
|
||||||
|
Reference in New Issue
Block a user