From 37d4e0fbf505ff56b3e0116c32fd1736c2325ef0 Mon Sep 17 00:00:00 2001 From: Martin Date: Thu, 24 Oct 2024 21:23:01 +1100 Subject: [PATCH] fix ethics prereqs (#1201) * fix ethics by making prereq preprocess pattern recognise it * update test --- backend/data/final_data/conditions.pkl | Bin 286971 -> 286877 bytes .../data/final_data/conditionsProcessed.json | 2 +- backend/data/final_data/conditionsTokens.json | 16 +++------------- .../processors/conditions_preprocessing.py | 2 +- .../data/processors/manual_fixes/COMPFixes.py | 8 -------- .../test_courses_unlocked_when_taken.py | 2 +- 6 files changed, 6 insertions(+), 24 deletions(-) diff --git a/backend/data/final_data/conditions.pkl b/backend/data/final_data/conditions.pkl index add86bff7e90a9fd7e7df78461ec7f9351b266fc..8ecece05d0fd1ae2d9c782177a7942600d22a8a5 100644 GIT binary patch delta 4872 zcmb_fdr*|u73ZA$@mP87w>(4^6i^fuaNVegJVeAtH1bfQvrlOdwfq$*J~K0+j+_uE|(zPnDH&UF9T?|0AZ zch3FJJ>PxWpl)hVSMGz-!M4_9Uoeqcg+a>boJqMfcq4{TeFP}nY=z-|K2-xeJQmF@ z=}DtTLkLx*gF#s@mS|x%gxg-9>q}GnVmQ^0fmk}(1H8%78~o`}I>gh`bO^2;3W1a} z8X~A@B$VSv187fwNTAn8LMUaA1`8F%VIa@VfJ{%Ujn{;UR38Oiv@Q!q(3*TSIJpFl zg$G7#Po#z_2%^yGpkiC1?d+{6{^E4_hQ+icI$8E#Ra0405?%IK!ajpEWirkHg_h3* zbBxa*y+ONV@YvzqVZfVa!g!3nB3U#`xQXhkAeipX5=E%VfiPRfwQjaV276#B<|Z1cU_ZPN-kzd`C`;($;o&G`nMFL6 zb%<3bkwg2T*%bdP79*Gz{hMO~tStamVuY)o76LaTg|I z1%~j}`PdQ=Ts~cIQ!21c4UFQ(N(=`$&j+r+@v6GDK(A(}x^-d;->t$kV5hQm7^`lO zRQ75re{@^kN~zTt3l3=r{iYh*p@=VDk83cm_e_0|q8vRAm*kN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i?224UC`r1yw8s2$Z@hHUbknHq~Af&4%Y8RBc~_RxThy*I?3A1 zM&;y6A>@=~ZkcPQmQp7bY-Wd3>Ljk$CH$&{>$NM(NLpKi7V7X5Ux7s|&9VB-C@R{? zLaB$?pK|LZADMHRq%T}$Y)xH;{$!z36U7s2U<z9#NvK4f+pK Cl34=) diff --git a/backend/data/final_data/conditionsProcessed.json b/backend/data/final_data/conditionsProcessed.json index a9e9c48ce..2c689aba6 100644 --- a/backend/data/final_data/conditionsProcessed.json +++ b/backend/data/final_data/conditionsProcessed.json @@ -3760,7 +3760,7 @@ }, "COMP4920": { "original": "Prerequisite: Completion of 18 UOC of COMP**** courses

", - "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.

", diff --git a/backend/data/final_data/conditionsTokens.json b/backend/data/final_data/conditionsTokens.json index e6d5471e0..4bc178ecb 100644 --- a/backend/data/final_data/conditionsTokens.json +++ b/backend/data/final_data/conditionsTokens.json @@ -8465,19 +8465,9 @@ ], "COMP4920": [ "(", - "(", - "COMP2511", - "||", - "COMP2911", - ")", - "&&", - "96UOC", - "&&", - "(", - "COMP?1", - "||", - "COMP?H", - ")", + "18UOC", + "in", + "COMP", ")" ], "COMP4951": [ diff --git a/backend/data/processors/conditions_preprocessing.py b/backend/data/processors/conditions_preprocessing.py index b3f69fe6b..7827fc56e 100644 --- a/backend/data/processors/conditions_preprocessing.py +++ b/backend/data/processors/conditions_preprocessing.py @@ -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""" diff --git a/backend/data/processors/manual_fixes/COMPFixes.py b/backend/data/processors/manual_fixes/COMPFixes.py index fa6ac2739..2c1dc189e 100644 --- a/backend/data/processors/manual_fixes/COMPFixes.py +++ b/backend/data/processors/manual_fixes/COMPFixes.py @@ -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() @@ -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.

", - "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.

" diff --git a/backend/server/tests/courses/test_courses_unlocked_when_taken.py b/backend/server/tests/courses/test_courses_unlocked_when_taken.py index 460a9971b..06716a438 100644 --- a/backend/server/tests/courses/test_courses_unlocked_when_taken.py +++ b/backend/server/tests/courses/test_courses_unlocked_when_taken.py @@ -96,5 +96,5 @@ def test_two_courses_completed(): "COMP9727", "MTRN2500", ], - "indirect_unlock": ["BABS3301", "BEIL0011", "MUSC2117", "TABL2710"] + "indirect_unlock": ["BABS3301", "BEIL0011", "COMP4920", "MUSC2117", "TABL2710"] }