replaced generic "Event" label with substitution or lesson text

This commit is contained in:
2026-09-24 22:22:43 +02:00
parent 498d195138
commit 4f31e68456
4 changed files with 81 additions and 4 deletions
@@ -1,4 +1,5 @@
import '../../../../api/marianumconnect/queries/timetable_get_week/timetable_get_week_response.dart';
import 'lesson_labels.dart';
/// Derives a human-readable title from the Marianum-Connect `lessonType` for
/// lessons that have no subject of their own (Aufsicht, Sprechstunde, …).
@@ -10,10 +11,20 @@ class LessonTypeLabel {
static String forEntry(McTimetableEntry lesson) {
final base = baseLabel(lesson.lessonType);
if (base == fallback) {
final text = entryText(lesson);
if (text != null) return text;
}
final room = (lesson.rooms.firstOrNull ?? '').trim();
return room.isEmpty ? base : '$room $base';
}
/// Webuntis-Freitext eines fachlosen Eintrags („Klassenfahrt 8a“), der
/// aussagekräftiger ist als das generische „Event“.
static String? entryText(McTimetableEntry lesson) =>
collapseWhitespace(lesson.substitutionText) ??
collapseWhitespace(lesson.lessonText);
/// Returns just the type wording without the room — useful when the caller
/// renders the room separately (e.g. as a subtitle line).
static String baseLabel(String lessonType) {