Skip to content

Commit

Permalink
fix ethics prereqs (#1201)
Browse files Browse the repository at this point in the history
* fix ethics by making prereq preprocess pattern recognise it

* update test
  • Loading branch information
martanman authored Oct 24, 2024
1 parent 556eb69 commit 37d4e0f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 24 deletions.
Binary file modified backend/data/final_data/conditions.pkl
Binary file not shown.
2 changes: 1 addition & 1 deletion backend/data/final_data/conditionsProcessed.json
Original file line number Diff line number Diff line change
Expand Up @@ -3760,7 +3760,7 @@
},
"COMP4920": {
"original": "Prerequisite: Completion of 18 UOC of COMP**** courses<br/><br/>",
"processed": "(COMP2511 || COMP2911) && 96UOC && (COMP?1 || COMP?H)"
"processed": "18UOC in COMP"
},
"COMP4951": {
"original": "Prerequisite: Enrolled in a CSE BE (Hons) programs, completion of 126 UOC and completion of 3rd year core.<br/><br/>",
Expand Down
16 changes: 3 additions & 13 deletions backend/data/final_data/conditionsTokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -8465,19 +8465,9 @@
],
"COMP4920": [
"(",
"(",
"COMP2511",
"||",
"COMP2911",
")",
"&&",
"96UOC",
"&&",
"(",
"COMP?1",
"||",
"COMP?H",
")",
"18UOC",
"in",
"COMP",
")"
],
"COMP4951": [
Expand Down
2 changes: 1 addition & 1 deletion backend/data/processors/conditions_preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ def uoc_in_business_school(processed: str) -> str:
return processed

def uoc_in_school(processed: str) -> str:
return re.sub(r"(\d+UOC) (in|of|at) ([A-Z]{4}) courses", r"\1 in \3", processed)
return re.sub(r"(\d+ *UOC) (in|of|at) ([A-Z]{4})(\*{4})? courses", r"\1 in \3", processed)

def l2_math_courses(processed: str) -> str:
"""Converts L2 Maths courses to L@ MATH"""
Expand Down
8 changes: 0 additions & 8 deletions backend/data/processors/manual_fixes/COMPFixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def fix_conditions():
CONDITIONS["COMP3901"] = COMP_3901_2(CONDITIONS["COMP3901"])
CONDITIONS["COMP3902"] = COMP_3901_2(CONDITIONS["COMP3902"])
CONDITIONS["COMP4141"][PROCESSED] = COMP_4141()
CONDITIONS["COMP4920"][PROCESSED] = COMP_4920()
CONDITIONS["COMP4951"] = COMP_4951(CONDITIONS["COMP4951"])
CONDITIONS["COMP4952"][PROCESSED] = COMP_4952()
CONDITIONS["COMP4953"][PROCESSED] = COMP_4953()
Expand Down Expand Up @@ -127,13 +126,6 @@ def COMP_4141():
"""
return "MATH1081 && (COMP1927 || COMP2521)"

def COMP_4920():
"""
"original": "Prerequisite: (COMP2511 or COMP2911) and completion of 96 UOC in Computer Science.<br/><br/>",
"processed": "(COMP2511 || COMP2911) && 96UOC in Computer Science"
"""
return "(COMP2511 || COMP2911) && 96UOC && (COMP?1 || COMP?H)"

def COMP_4951(conditions):
"""
"original": "Prerequisite: Enrolled in a CSE BE (Hons) programs, completion of 126 UOC and completion of 3rd year core.<br/><br/>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,5 @@ def test_two_courses_completed():
"COMP9727",
"MTRN2500",
],
"indirect_unlock": ["BABS3301", "BEIL0011", "MUSC2117", "TABL2710"]
"indirect_unlock": ["BABS3301", "BEIL0011", "COMP4920", "MUSC2117", "TABL2710"]
}

0 comments on commit 37d4e0f

Please sign in to comment.