Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Today page not handling boundary between semesters properly #3757

Open
Wxy2003-xy opened this issue Jul 31, 2024 · 6 comments
Open

Today page not handling boundary between semesters properly #3757

Wxy2003-xy opened this issue Jul 31, 2024 · 6 comments
Labels

Comments

@Wxy2003-xy
Copy link
Contributor

Wxy2003-xy commented Jul 31, 2024

Refer to #3757 (comment) for analysis of this issue.


Today dashboard display classes only according to days in week, not checking if the class is conducted on particular weeks

  1. Go to 'Today'

Expected behavior

Tutorial slot not showing up on 1 Aug, which only starts from week 1

Actual behavior

Slot showed up

Screenshots

Image 31-7-24 at 13 01

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MacOS
  • Browser Chrome
  • Version [20240726-3e1ce70]

Additional context

Add any other context about the problem here.

@ravern
Copy link
Member

ravern commented Aug 28, 2024

I'm able to reproduce this for CS2104. Behaviour seems quite finnicky, perhaps can investigate fully before making the fixes.

image

@xinyuwang-nus
Copy link
Contributor

I'm able to reproduce this for CS2104. Behaviour seems quite finnicky, perhaps can investigate fully before making the fixes.

image

I made a new commit based on a292172.
Looks like being fixed

@Wxy2003-xy
Copy link
Contributor Author

I'm able to reproduce this for CS2104. Behaviour seems quite finnicky, perhaps can investigate fully before making the fixes.

image

Apology, this issue has been fixed by #3760, i forgot to close the issue.

@ravern
Copy link
Member

ravern commented Aug 28, 2024

Re-opening this issue becuase #3760 wasn't merged, the author closed the PR without merging.

Can I check if it was merged in some other PR that isn't linked by this issue? I think that this issue went away by itself because the semester started, and not due to the fix.

@ravern ravern reopened this Aug 28, 2024
@xinyuwang-nus
Copy link
Contributor

Re-opening this issue becuase #3760 wasn't merged, the author closed the PR without merging.

Can I check if it was merged in some other PR that isn't linked by this issue? I think that this issue went away by itself because the semester started, and not due to the fix.

I also closed my pr for now cause I found getWeek(date) wasn’t returning the expected week number. Will look into this next week

@ravern
Copy link
Member

ravern commented Sep 30, 2024

This has taken a while, but big thanks to @xinyuwang-nus on #3814 whose fix pointed out some deeper issues.

  1. Special term modules do not work at all in the current Today page. Functionality already exists for them to show up properly, so this is just a bug to fix. I've filed this in Modules in Special Term do not show up in Today page #3830.

  2. It seems like the way boundaries between two semesters are rendered is bugged. We only ever render modules from one semester, so this causes issues during the first/last week of each semester. This GitHub issue will be rescoped to solve this problem.

Explanation

We only ever render modules from one semester. So on the last Thursday of Semester 1, do we render the Thursday class of Semester 1, or the Monday class of Semester 2. The correct answer is both, but it seems like there's no code to currently support that.

The current code in TodayContainer.tsx picks a single semester and passes that as an argument to the data fetching functions.

export const mapStateToProps = (state: StoreState, ownProps: OwnProps) => {
const { modules } = state.moduleBank;
const lastDay = addDays(ownProps.currentTime, DAYS);
const weekInfo = NUSModerator.academicCalendar.getAcadWeekInfo(lastDay);
const semester = semesterNameMap[weekInfo.sem];
const timetable = getSemesterTimetableLessons(state)(semester);
const colors = getSemesterTimetableColors(state)(semester);
const timetableWithLessons = hydrateSemTimetableWithLessons(timetable, modules, semester);
return {
colors,
timetableWithLessons,
};
};

In the past, a special fix was added in #1391 to handle the boundary between Semester 1 and 2. However, the fix doesn't work because it relies on there not being any classes in Semester 1, since it just switches to rendering Semester 2 modules one week early.

This causes problems when the opposite case is true, i.e. for the boundary between Special Term II and Semester 1, which surfaces as modules being wrongly rendered as in this issue and in #2789.

Solution

A full fix to this problem would be fetch the modules from both semesters and render them accordingly, in the mapStateToProps function linked above^

In the interim, I'm okay to merge #3814 (pending fixes to linting) since Special Term rendering of modules is broken anyway. The solution there reverses the fix in #1391 and then handles the boundary between Semester 1 and Semester 2 as a special case.

@ravern ravern changed the title Today Dashboard does not check the weeks of classes, showing time slots regardless Today page not handling boundary between semesters properly Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants