Skip to content

Commit

Permalink
fix: Display only unique calendar lesson events (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
0niel authored May 23, 2023
1 parent 1ff92fc commit f2d8d29
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/presentation/pages/schedule/widgets/schedule_page_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -251,11 +251,22 @@ class _SchedulePageViewState extends State<SchedulePageView> {
final int week = CalendarUtils.getCurrentWeek(mCurrentDate: day);
final int weekday = day.weekday - 1;

var lessons = _getLessonsByWeek(week, widget.schedule);
final lessons = _getLessonsByWeek(week, widget.schedule);
if (weekday == 6) {
return [];
} else {
return lessons[weekday];
final Map<String, Lesson> uniqueLessonEvents = {};

for (var lesson in lessons[weekday]) {
final lessonNameAndTime = '${lesson.name}${lesson.timeStart}';
if (uniqueLessonEvents.containsKey(lessonNameAndTime)) {
continue;
}

uniqueLessonEvents[lessonNameAndTime] = lesson;
}

return uniqueLessonEvents.values.toList();
}
},
locale: 'ru_RU',
Expand Down

0 comments on commit f2d8d29

Please sign in to comment.