Skip to content
Browse files

Fixed bug in class combination creation - filtering class conflicts w…

…as not working correctly
  • Loading branch information...
1 parent 5690742 commit 3cc0e118b835e1bfa17f63727df23c67a2e1884f David Petersen committed Jun 23, 2011
Showing with 6 additions and 4 deletions.
  1. +4 −2 reglib/utilities/make_schedule.py
  2. +2 −2 test.py
View
6 reglib/utilities/make_schedule.py
@@ -68,8 +68,10 @@ def make_schedule(list_of_classes, term, schedule):
if index == 0:
continue
for inner_index, course in enumerate(permutation):
- if class_search_conflict(course, permutation[inner_index-1]):
- permutation.remove(permutation[inner_index-1])
+ for second_inner_index, each_course in enumerate(permutation):
+ if second_inner_index != inner_index:
+ if class_search_conflict(course, permutation[second_inner_index]):
+ permutation.remove(permutation[second_inner_index])
return {"combinations" : permutations, "classes_possible" : len(class_search_results)}
# for permutation in permutations:
View
4 test.py
@@ -48,8 +48,8 @@
###################
permutations = reg_class.make_schedule(['fr 211', 'cs 160', 'cs 275', 'mth 231'])
#print permutations
-for index, permutation in enumerate(permutations['combinations']):
- print "Permutation " + str(index+1) + ": " + str([''.join(['(',course['type'],') ', course['department'], ' ', course['number'], ' ', course['crn']]) for course in permutation])
+#for index, permutation in enumerate(permutations['combinations']):
+# print "Permutation " + str(index+1) + ": " + str([''.join(['(',course['type'],') ', course['department'], ' ', course['number'], ' ', course['crn']]) for course in permutation])
print "\nPermutations: " + str(len(permutations['combinations']))
#print reg_class.make_schedule(['cs 162', 'mth 111'], 'F12')

0 comments on commit 3cc0e11

Please sign in to comment.
Something went wrong with that request. Please try again.