Skip to content

Commit

Permalink
Fix bugs of substitution plan (#1662)
Browse files Browse the repository at this point in the history
Tests would have prevented adding the bugs in #1647 :(
  • Loading branch information
nilsreichardt authored Jun 10, 2024
1 parent 561e947 commit aaed4ac
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/lib/dashboard/bloc/build_lesson_views.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ List<LessonView> _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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit aaed4ac

Please sign in to comment.