From a292172daea62ccab9eb3a224862b06203913682 Mon Sep 17 00:00:00 2001 From: iZUMi-kyouka <164025287+iZUMi-kyouka@users.noreply.github.com> Date: Thu, 1 Aug 2024 18:51:34 +0700 Subject: [PATCH] Fixed timetable bug Fixed a timetable bug whereby lectures/tutorials that are not going on the current week is showing up in today's side panel --- .../src/views/today/TodayContainer/TodayContainer.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/website/src/views/today/TodayContainer/TodayContainer.tsx b/website/src/views/today/TodayContainer/TodayContainer.tsx index ee03e6ec9c..e8dcbfc362 100644 --- a/website/src/views/today/TodayContainer/TodayContainer.tsx +++ b/website/src/views/today/TodayContainer/TodayContainer.tsx @@ -261,6 +261,16 @@ export class TodayContainerComponent extends React.PureComponent { // of displaying inline inside the lesson, so the opened lesson is always null const openLesson = this.props.matchBreakpoint ? null : this.state.openLesson; + // FIlter out lessons that is not running at the current week + lessons = lessons.filter((lesson) => { + let weeksArray = lesson.weeks.toString().split(',').map((s) => parseInt(s)); + if (weeksArray.includes(getWeek(date))) { + return true; + } else { + return false; + } + }); + // If it is a day with no lessons if (!lessons.length) { return

You have no lessons today

;