Skip to content

Commit

Permalink
Fixed timetable bug
Browse files Browse the repository at this point in the history
Fixed a timetable bug whereby lectures/tutorials that are not going on the current week is showing up in today's side panel
  • Loading branch information
iZUMi-kyouka authored Aug 1, 2024
1 parent 56498cd commit a292172
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions website/src/views/today/TodayContainer/TodayContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,16 @@ export class TodayContainerComponent extends React.PureComponent<Props, State> {
// 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 <p>You have no lessons today</p>;
Expand Down

0 comments on commit a292172

Please sign in to comment.