UQComputingSociety / uqcsbot-discord

:mortar_board: UQCSbot: Our friendly little Discord bot
https://discord.uqcs.org
MIT License
20 stars 19 forks source link

more ECP inference #174

Open andrewj-brown opened 8 months ago

andrewj-brown commented 8 months ago

The new courseecp command falls over rather rapidly if something changes from it's expected defaults. It's still capable of returning the ECP, but you have to provide it with every parameter.

This is not ideal for courses that are internally consistent, but just don't line up with the default search parameters. For instance, if you are looking for the ECP for a course that only ever runs in sem 1, and UQCSBot defaults to the current sem, it will fail to find an ECP in sem 2.

For courses that run in both sems, this is a very sensible default. However, we should investigate fallbacks that conduct broader searches for ECPs and just notify the user that the ECP they've been given is from a different sem / campus.

This is primarily just for semester differences - it's probably enough to just have a fallback that checks the other 'main' semester and then gives up.

ew-b commented 8 months ago

The /courseecp is modelled after /whatsdue and /pastexams. Former of which are fairly semester context dependent where /courseecp is not. A way to fix this would be web scraping to first check what semester(s), campus and mode(s) the course is run in to set as the default inputs instead of assuming current semester, St Lucia, and Internal immediately. So mild logic fixes really

(I did not in fact read the whole issue before typing, SWOTVAC has me dying so don't mind the repeating text)

ew-b commented 7 months ago

Working on this at the moment: Inuq-course-utils.py, when get_course_profile_url is called it grabs the most first url on the program course page when offering is None(so when mode, campusis None). Going off that, I can make campusand modedefault to None, and when both are None, then set offering to None, giving us the most recent ECP.

For cases where modeis given but campusis not (or vice versa), I need to work out a way to nicely do the web request to get the most recent details since I can't see a logic way out to this.