nusmods icon indicating copy to clipboard operation
nusmods copied to clipboard

Prerequisite check for AT LEAST n prefixed modules not working as intended

Open Wxy2003-xy opened this issue 1 year ago • 1 comments

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior:

  1. Plan for a course with prereq tree contain "nOf": [ n, [ "PREFIX%:GRADE" ] ] example: JS4207
  2. fill in prerequisite modules accordingly example: Japanese 1 - 5, any 3 JS coded modules

Expected behavior

JS4207 should pass prerequisite check

Screenshots

Image 6-7-24 at 09 21

Desktop (please complete the following information):

  • OS: [e.g. MacOS]
  • Browser [e.g. Chrome]
  • Version [e.g. Beta]

Additional context

Found out this when testing our orbital project nusplanner

Wxy2003-xy avatar Jul 06 '24 01:07 Wxy2003-xy

I can reproduce this.

We just merged in a PR to update the pre-requisite check (#3737), but seems like it doesn't work specifically in the AT LEAST N prefixed modules case.

Thanks for filing this.

ravern avatar Jul 06 '24 03:07 ravern

Hi can I check if there are any modules that has prerequisites that contains both specific and prefix% codes in one nOf? (i.e. at least 3 of CS3123/CS2% mods) ?

Because if the only combination is "at least N of " followed by only 1 prefix% code (like in JS4207), then I can try to come up with a solution for it without having to change the walkTree function too much.

ChillinRage avatar Jul 08 '24 14:07 ChillinRage

Hi can I check if there are any modules that has prerequisites that contains both specific and prefix% codes in one nOf? (i.e. at least 3 of CS3123/CS2% mods) ?

Because if the only combination is "at least N of " followed by only 1 prefix% code (like in JS4207), then I can try to come up with a solution for it without having to change the walkTree function too much.

I'm not sure if there exists such case, but I'd like to propose a solution we used, which is to separate the match checking logic from the recursive check tree function, and handle wildcard case there.

Wxy2003-xy avatar Jul 10 '24 10:07 Wxy2003-xy

I'm not sure if there exists such case, but I'd like to propose a solution we used, which is to separate the match checking logic from the recursive check tree function, and handle wildcard case there.

Hm if you would like, you can try to create a PR for the proposed solution.

ChillinRage avatar Jul 10 '24 10:07 ChillinRage

Fixed in #3758

zwliew avatar Aug 17 '24 08:08 zwliew