🐛 Fix comparing classes and matching some entries
This commit is contained in:
@ -101,13 +101,19 @@ export class Parser {
|
|||||||
const classes = this.getSubstitutionClasses(classList, change.class);
|
const classes = this.getSubstitutionClasses(classList, change.class);
|
||||||
if (classes.length == 0) classes.push(change.class || "unknown");
|
if (classes.length == 0) classes.push(change.class || "unknown");
|
||||||
|
|
||||||
|
// Workaround no currect match possible for subsitutions of this
|
||||||
|
// type beacuse they don't have a class and a subject attribute
|
||||||
|
if (change.type == "Sondereins." && !change.subject) {
|
||||||
|
change.subject = change.notes;
|
||||||
|
}
|
||||||
|
|
||||||
const matchingSubstitution = knownSubstitutions.find((substitution) => {
|
const matchingSubstitution = knownSubstitutions.find((substitution) => {
|
||||||
return substitution.date == new Date(date).setUTCHours(0, 0, 0, 0) &&
|
return substitution.date == new Date(date).setUTCHours(0, 0, 0, 0) &&
|
||||||
substitution.type == (change.type == "Entfall")
|
substitution.type == (change.type == "Entfall")
|
||||||
? "cancellation"
|
? "cancellation"
|
||||||
: "change" &&
|
: "change" &&
|
||||||
substitution.lesson == change.lesson &&
|
substitution.lesson == change.lesson &&
|
||||||
classes.every((el) => substitution.class.includes(el)) &&
|
classes.sort().join(",") == substitution.class.sort().join(",") &&
|
||||||
substitution.changedSubject == change.subject;
|
substitution.changedSubject == change.subject;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -119,7 +125,7 @@ export class Parser {
|
|||||||
type: change.type == "Entfall" ? "cancellation" : "change",
|
type: change.type == "Entfall" ? "cancellation" : "change",
|
||||||
lesson: parseInt(change.lesson),
|
lesson: parseInt(change.lesson),
|
||||||
changedTeacher: change.changedTeacher,
|
changedTeacher: change.changedTeacher,
|
||||||
changedRoom: change.type == "Raum-Vtr." ? change.room : undefined,
|
changedRoom: change.room || undefined,
|
||||||
changedSubject: change.subject,
|
changedSubject: change.subject,
|
||||||
notes: change.notes,
|
notes: change.notes,
|
||||||
removed: false,
|
removed: false,
|
||||||
|
Reference in New Issue
Block a user