diff --git a/test/scheduleGenerator/generator_v3.py b/test/scheduleGenerator/generator_v3.py index 9acda84..dfc3485 100644 --- a/test/scheduleGenerator/generator_v3.py +++ b/test/scheduleGenerator/generator_v3.py @@ -385,12 +385,12 @@ def generateScheduleV3( # or classes the student is inserted to is missing # no more than two classes: # continue to next student - if ( - not hasConflicts and ( - student["classes"] == student["expectedClasses"] or - (student["expectedClasses"]-2) <= student["classes"] < student["expectedClasses"] - ) - ): continue + if not hasConflicts and student["classes"] == student["expectedClasses"]: continue + elif not hasConflicts and (student["expectedClasses"]-2) <= student["classes"] < student["expectedClasses"]: + a_mc_count += 1 + acceptableCount += 1 + if not newConflict(student["Pupil #"], "", "Acceptable", "A-MC", "Missing 1-2 Classses", conflictLogs): studentsAcceptable += 1 + continue studentData = { "Pupil #": student["Pupil #"], @@ -408,7 +408,7 @@ def generateScheduleV3( # list to ginore them when looking for clashes, and not to # accidently overwrite while evaluating other classes if len(exceptions) > 0: - for i, block in enumerate(blocks): + for i in range(len(blocks)): if i in exceptions: blocks[i] = ['EXPT'] conflicts = sum(1 for b in blocks if len(b)>1) @@ -504,7 +504,11 @@ def generateScheduleV3( break - if not found_oBlockSolution: exceptions.append(clashIndex) + if not found_oBlockSolution: + exceptions.append(clashIndex) + criticalCount += 1 + c_cr_count += 1 + if not newConflict(student["Pupil #"], "", "Critial", "C-CR", "Couldn't Resolve", conflictLogs): studentsCritical += 1 foundSolution = True break @@ -513,8 +517,11 @@ def generateScheduleV3( if classOutIndex < len(blocks[clashIndex]) - 1: classOutIndex += 1 elif classOutIndex == len(blocks[clashIndex]) - 1: if len(student["remainingAlts"]) > 0: - # pass exceptions.append(clashIndex) + criticalCount += 1 + c_cr_count += 1 + if not newConflict(student["Pupil #"], "", "Critical", "C-CR", "Couldn't Resolve", conflictLogs): studentsCritical += 1 + attemptResolve = False # Attempt to use alt elif len(student["remainingAlts"]) == 0: @@ -555,13 +562,6 @@ def generateScheduleV3( print(f"Fatal error ({getLineNumber()}): Impossible error") continue - criticals = [] - acceptables = [] - for student in conflictLogs: - for conflict in conflictLogs[student]: - if conflict["Type"] == "Critical": criticals.append(conflict) - elif conflict["Type"] == "Acceptable": acceptables.append(conflict) - finalConflictLogs = { "Conflicts": conflictLogs, "Critical": { diff --git a/test/tinker.py b/test/tinker.py index 37a1bfa..393134e 100644 --- a/test/tinker.py +++ b/test/tinker.py @@ -22,15 +22,15 @@ def errorOutput(students) -> Tuple[PrettyTable, dict, dict]: totalCritical = conflicts["Critical"]["Students"] totalAcceptable = conflicts["Acceptable"]["Students"] - t = PrettyTable(['Type', 'Error %', 'Success %', 'Error Ratio']) + t = PrettyTable(['Type', 'Error %', 'Success %', 'Student Error Ratio']) errorsC = round(totalCritical / len(students) * 100, 2) successC = round(100 - errorsC, 2) errorsA = round(totalAcceptable / len(students) * 100, 2) successA = round(100 - errorsA, 2) - t.add_row(['Critical', f"{errorsC} %", f"{successC} %", f"{totalCritical}/{len(students)}"]) - t.add_row(['Acceptable', f"{errorsA} %", f"{successA} %", f"{totalAcceptable}/{len(students)}"]) + t.add_row(['Critical', f"{errorsC} %", f"{successC} %", f"{totalCritical}/{len(students)} Students"]) + t.add_row(['Acceptable', f"{errorsA} %", f"{successA} %", f"{totalAcceptable}/{len(students)} Students"]) return t, conflicts["Critical"], conflicts["Acceptable"]