nusmodifications / nusmods

🏫 Official course planning platform for National University of Singapore.
https://nusmods.com
MIT License
582 stars 316 forks source link

Allow filtering for "evening courses" #3668

Open kokrui opened 6 months ago

kokrui commented 6 months ago

This has historically been a very common request. We should allow users to filter courses by whether they are "evening" course.

I'm not sure if there is a universally-agreed definition of "evening course", but I think a reasonable implementation could be that for all types of slots (lecture/tutorial/lab/etc.), there must exist at least 1 slot that is beyond 6pm

Feel free to suggest alternative interpretations though!

jushg commented 6 months ago

Hi @kokrui. Judging from the context, most student would want the filtering for choosing modules to take on Industrial Attachments or ATAP. NUS allows a student to enroll in a module if it doesn't interfere with working hours, meaning if one's work ends at 5pm, they can enroll in a module that has a lecture that begins at 530pm.

Hence, I think that it would be better for the filtering to allow user to choose the time they want to consider as evening (e.g. beyond 7pm/ beyond 5pm), instead of fix at 6pm.

woojiahao commented 6 months ago

This could be a generic filter that allows people to filter by time for modules that satisfy the condition that @kokrui mentioned. So it can apply for 5pm onwards, 5.30pm onwards, etc.

chew01 commented 6 months ago

I think a good implementation of that generic filter would have a time slider. Either way, an implementation of this would require sending more data to Elastic servers. We will need to include SemesterData.timetable, or at least pre-process for the latest possible classes, in the payload to index ~modules~ courses by latest classes, so that the data can be exposed to the filter.

Also that we probably will have to filter courses that have both lectures and tutorials after given time...?

On a side note, I'm thinking if having a mock payload for elastic search result is worth the overhead, considering any frontend development right now related to new features relies on live data...

kokrui commented 6 months ago

A time slider/picker sounds good and I'd be happy to accept PRs that implement that -- I think we can extend this to 2 time sliders for "BEFORE" and "AFTER", for people who want to end lessons early / start lessons late / a combination of both.

I can't think of a good concise wording to capture the "forall slot types, there exists 1 slot that's before/after X" right now though, hm

kokrui commented 6 months ago

This is a good reference PR for adding filterable fields! https://github.com/nusmodifications/nusmods/pull/3666

lubong commented 1 month ago

I'll work on this!