From 615a1c8342d270713e43502dbee02b22bb0f71a3 Mon Sep 17 00:00:00 2001 From: nilsreichardt Date: Mon, 10 Jun 2024 21:51:05 +0200 Subject: [PATCH] Fix bugs of substitution plan --- app/lib/dashboard/bloc/build_lesson_views.dart | 3 ++- .../timetable/timetable_page/lesson/substitution_section.dart | 2 +- .../timetable/timetable_page/lesson/timetable_lesson_tile.dart | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/lib/dashboard/bloc/build_lesson_views.dart b/app/lib/dashboard/bloc/build_lesson_views.dart index 0659db545..cd9aedf6a 100644 --- a/app/lib/dashboard/bloc/build_lesson_views.dart +++ b/app/lib/dashboard/bloc/build_lesson_views.dart @@ -18,7 +18,8 @@ List _buildSortedViews( final views = [ for (final lesson in lessons) - if (lesson.getSubstitutionFor(date) is! LessonCanceledSubstitution) + if (lesson.getSubstitutionFor(date).getLessonCanceledSubstitution() == + null) _buildLessonView( lesson, groupInfo: groupInfoOf(lesson), diff --git a/app/lib/timetable/timetable_page/lesson/substitution_section.dart b/app/lib/timetable/timetable_page/lesson/substitution_section.dart index f56272702..c58ccd3ed 100644 --- a/app/lib/timetable/timetable_page/lesson/substitution_section.dart +++ b/app/lib/timetable/timetable_page/lesson/substitution_section.dart @@ -51,7 +51,7 @@ class _SubstitutionSection extends StatelessWidget { if (canceledSubstitution != null) _LessonCanceledCard( courseId: lesson.groupID, - createdBy: locationSubstitution!.createdBy, + createdBy: canceledSubstitution.createdBy, hasPermissionsToManageLessons: hasPermissionsToManageLessons, ), if (locationSubstitution != null) diff --git a/app/lib/timetable/timetable_page/lesson/timetable_lesson_tile.dart b/app/lib/timetable/timetable_page/lesson/timetable_lesson_tile.dart index e53c8ed35..0ec0e6d03 100644 --- a/app/lib/timetable/timetable_page/lesson/timetable_lesson_tile.dart +++ b/app/lib/timetable/timetable_page/lesson/timetable_lesson_tile.dart @@ -34,7 +34,7 @@ class TimetableEntryLesson extends StatelessWidget { Widget build(BuildContext context) { final canceledDesign = Design.fromColor(Colors.grey[600]!); final substitutions = lesson.getSubstitutionFor(date); - final isCanceled = substitutions is LessonCanceledSubstitution; + final isCanceled = substitutions.getLessonCanceledSubstitution() != null; final design = isCanceled ? canceledDesign : groupInfo?.design; final newLocation = substitutions.getLocationChangedSubstitution()?.newLocation;