✨ Add support for other substitution types
- Store and display original substitution type text - Treat "eigenverantwortliches Arbeiten" as cancellation
This commit is contained in:
@ -177,6 +177,7 @@ export async function getSubstitutions(req, res) {
|
|||||||
id: element.id,
|
id: element.id,
|
||||||
class: element.class,
|
class: element.class,
|
||||||
type: element.type,
|
type: element.type,
|
||||||
|
rawType: element.rawType,
|
||||||
lesson: element.lesson,
|
lesson: element.lesson,
|
||||||
date: new Date(element.date).getTime(),
|
date: new Date(element.date).getTime(),
|
||||||
notes: element.notes,
|
notes: element.notes,
|
||||||
|
@ -96,15 +96,15 @@ export class Parser {
|
|||||||
// (Date, Type, Lesson, Classes and Subject need to be the same)
|
// (Date, Type, Lesson, Classes and Subject need to be the same)
|
||||||
const matchingSubstitutionId = knownSubstitutions.findIndex(
|
const matchingSubstitutionId = knownSubstitutions.findIndex(
|
||||||
(substitution) => {
|
(substitution) => {
|
||||||
return substitution.date == new Date(date).setUTCHours(0, 0, 0, 0) &&
|
return (
|
||||||
substitution.type == (change.type == "Entfall")
|
substitution.date.getTime() ==
|
||||||
? "cancellation"
|
new Date(date).setUTCHours(0, 0, 0, 0) &&
|
||||||
: "change" &&
|
substitution.rawType == change.type &&
|
||||||
substitution.lesson == change.lesson &&
|
substitution.lesson == change.lesson &&
|
||||||
classes.sort().join(",") ==
|
classes.sort().join(",") == substitution.class.sort().join(",") &&
|
||||||
substitution.class.sort().join(",") &&
|
substitution.changedSubject == change.subject &&
|
||||||
substitution.changedSubject == change.subject &&
|
substitution.teacher == (change.teacher || "")
|
||||||
substitution.teacher == (change.teacher || "");
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
const matchingSubstitution = knownSubstitutions[matchingSubstitutionId];
|
const matchingSubstitution = knownSubstitutions[matchingSubstitutionId];
|
||||||
@ -115,7 +115,12 @@ export class Parser {
|
|||||||
data: {
|
data: {
|
||||||
class: classes,
|
class: classes,
|
||||||
date: new Date(date),
|
date: new Date(date),
|
||||||
type: change.type == "Entfall" ? "cancellation" : "change",
|
type:
|
||||||
|
change.type == "Entfall" ||
|
||||||
|
change.type == "eigenverantwortliches Arbeiten"
|
||||||
|
? "cancellation"
|
||||||
|
: "change",
|
||||||
|
rawType: change.type,
|
||||||
lesson: parseInt(change.lesson),
|
lesson: parseInt(change.lesson),
|
||||||
teacher: change.teacher || "",
|
teacher: change.teacher || "",
|
||||||
changedTeacher: change.changedTeacher,
|
changedTeacher: change.changedTeacher,
|
||||||
@ -133,6 +138,7 @@ export class Parser {
|
|||||||
changes: {
|
changes: {
|
||||||
class: classes,
|
class: classes,
|
||||||
type: change.type == "Entfall" ? "cancellation" : "change",
|
type: change.type == "Entfall" ? "cancellation" : "change",
|
||||||
|
rawType: change.type,
|
||||||
lesson: parseInt(change.lesson),
|
lesson: parseInt(change.lesson),
|
||||||
date: new Date(date),
|
date: new Date(date),
|
||||||
notes: change.notes,
|
notes: change.notes,
|
||||||
@ -204,6 +210,7 @@ export class Parser {
|
|||||||
changes: {
|
changes: {
|
||||||
class: remainingSubstitution.class,
|
class: remainingSubstitution.class,
|
||||||
type: remainingSubstitution.type,
|
type: remainingSubstitution.type,
|
||||||
|
rawType: remainingSubstitution.rawType,
|
||||||
lesson: remainingSubstitution.lesson,
|
lesson: remainingSubstitution.lesson,
|
||||||
date: remainingSubstitution.date.getTime(),
|
date: remainingSubstitution.date.getTime(),
|
||||||
notes: remainingSubstitution.notes,
|
notes: remainingSubstitution.notes,
|
||||||
|
@ -27,6 +27,7 @@ model Substitution {
|
|||||||
class String[]
|
class String[]
|
||||||
date DateTime
|
date DateTime
|
||||||
type String
|
type String
|
||||||
|
rawType String @default("unknown")
|
||||||
lesson Int
|
lesson Int
|
||||||
teacher String
|
teacher String
|
||||||
changedTeacher String?
|
changedTeacher String?
|
||||||
|
@ -79,8 +79,11 @@ const chars = {
|
|||||||
room: event.change.change.room,
|
room: event.change.change.room,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}}<span class="notes" v-if="event.change.notes">
|
}}<span class="notes">
|
||||||
{{ $t("timetable.notes") }} {{ event.change.notes }}
|
<i>{{ event.change.rawType }}</i>
|
||||||
|
<span v-if="event.change.notes">
|
||||||
|
/ {{ $t("timetable.notes") }} {{ event.change.notes }}</span
|
||||||
|
>
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
<span class="notes">
|
<span class="notes">
|
||||||
|
@ -130,6 +130,9 @@ function getTime(index) {
|
|||||||
>, {{ $t("timetable.notes") }} {{ getNotes(lesson.substitution) }}
|
>, {{ $t("timetable.notes") }} {{ getNotes(lesson.substitution) }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<span class="info type" v-if="lesson.substitution">
|
||||||
|
<i>{{ lesson.substitution.rawType }}</i>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="times" v-if="getTime(index).start && !edit">
|
<div class="times" v-if="getTime(index).start && !edit">
|
||||||
<span>{{ getTime(index).start }} -</span>
|
<span>{{ getTime(index).start }} -</span>
|
||||||
|
@ -60,8 +60,11 @@ const substitutionsForDate = computed(() => {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
}}</span>
|
}}</span>
|
||||||
<span class="notes" v-if="substitution.notes">
|
<span class="detail">
|
||||||
{{ $t("timetable.notes") }} {{ substitution.notes }}
|
<i>{{ substitution.rawType }}</i>
|
||||||
|
<span v-if="substitution.notes">
|
||||||
|
/ {{ $t("timetable.notes") }} {{ substitution.notes }}</span
|
||||||
|
>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -98,7 +101,7 @@ const substitutionsForDate = computed(() => {
|
|||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notes {
|
.detail {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
font-weight: 100;
|
font-weight: 100;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user