solve issue #6
This commit is contained in:
2 files changed
+12
-16
No files matched your search
@@ -286,22 +286,15 @@ def generateScheduleV3(
|
|||||||
course = list(courseRunInfo)[index]
|
course = list(courseRunInfo)[index]
|
||||||
|
|
||||||
# Tally first and second semester
|
# Tally first and second semester
|
||||||
sem1, sem2 = 0, 0
|
sem1 = sum(len(running[f'block{i}']) for i in range(1, 6))
|
||||||
sem1List, sem2List = {}, {}
|
sem2 = sum(len(running[f'block{i}']) for i in range(6, 11))
|
||||||
allSemBlockLens = []
|
allSemBlockLens = [len(running[f'block{i}']) for i in range(1, 11)]
|
||||||
for i in range(1, 11):
|
|
||||||
allSemBlockLens.append(len(running[f"block{i}"]))
|
|
||||||
if i <= 5:
|
|
||||||
sem1 += len(running[f"block{i}"])
|
|
||||||
sem1List[f"block{i}"] = running[f"block{i}"]
|
|
||||||
elif i > 5:
|
|
||||||
sem2 += len(running[f"block{i}"])
|
|
||||||
sem2List[f"block{i}"] = running[f"block{i}"]
|
|
||||||
|
|
||||||
# If there is more than one class Running
|
# If there is more than one class Running
|
||||||
if allClassRunCounts[index] > 1:
|
if allClassRunCounts[index] > 1:
|
||||||
blockIndex = 0 if sem1 <= sem2 else 5
|
blockIndex = allSemBlockLens.index(min(allSemBlockLens))
|
||||||
stepType = 0 if sem1 <= sem2 else 1
|
startSem = 1 if blockIndex < 5 else 2
|
||||||
|
stepType = 0 if blockIndex < 5 else 1
|
||||||
offset = 0
|
offset = 0
|
||||||
|
|
||||||
# Spread classes throughout both semesters
|
# Spread classes throughout both semesters
|
||||||
@@ -323,7 +316,7 @@ def generateScheduleV3(
|
|||||||
offset = stepIndex(offset, stepType)
|
offset = stepIndex(offset, stepType)
|
||||||
|
|
||||||
if blockIndex >= 9:
|
if blockIndex >= 9:
|
||||||
blockIndex = 0 if sem1 <= sem2 else 5
|
blockIndex = 0 if stepType == 0 else 5
|
||||||
offset = 0
|
offset = 0
|
||||||
|
|
||||||
# If the class only runs once, place in semester with least classes
|
# If the class only runs once, place in semester with least classes
|
||||||
@@ -347,6 +340,9 @@ def generateScheduleV3(
|
|||||||
allClassRunCounts.remove(allClassRunCounts[index])
|
allClassRunCounts.remove(allClassRunCounts[index])
|
||||||
courseRunInfo.pop(list(courseRunInfo)[index])
|
courseRunInfo.pop(list(courseRunInfo)[index])
|
||||||
|
|
||||||
|
# # Debug step 4 output
|
||||||
|
# for i in range(1, 6):
|
||||||
|
# debug(f'block{i} - {len(running[f"block{i}"])} | block{i+5} - {len(running[f"block{i+5}"])}')
|
||||||
|
|
||||||
# Step 5 - Fill student schedule
|
# Step 5 - Fill student schedule
|
||||||
for block in running:
|
for block in running:
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ done = False
|
|||||||
# consts
|
# consts
|
||||||
blockClassLimit = 40
|
blockClassLimit = 40
|
||||||
|
|
||||||
print()
|
# print()
|
||||||
debug(f'Current blockClassLimit = {blockClassLimit}')
|
# debug(f'Current blockClassLimit = {blockClassLimit}')
|
||||||
|
|
||||||
def processing(msg: str):
|
def processing(msg: str):
|
||||||
for c in itertools.cycle(['|', '/', '-', '\\']):
|
for c in itertools.cycle(['|', '/', '-', '\\']):
|
||||||
|
|||||||
Reference in new issue
Block a user