Commit 4f10cd1c authored by Chris Reffett's avatar Chris Reffett
Browse files

maybe fixed

parent de082b80
...@@ -110,8 +110,8 @@ def requirementsFulfilled(taken, program): ...@@ -110,8 +110,8 @@ def requirementsFulfilled(taken, program):
taken = set(taken) taken = set(taken)
requirements = program.requirements requirements = program.requirements
for requirement in requirements: for requirement in requirements.all():
for coursegroup in requirement.coursegroup: for courses in requirement.courses.all():
courseRequirements = set(coursegroup.courses) courseRequirements = set(coursegroup.courses)
requirementCoursesTaken = courseRequirements.intersection(alreadyTaken) requirementCoursesTaken = courseRequirements.intersection(alreadyTaken)
...@@ -157,7 +157,7 @@ def nextCourses(remainingReqCourses, taken): ...@@ -157,7 +157,7 @@ def nextCourses(remainingReqCourses, taken):
nextcourses.append(course) nextcourses.append(course)
return nextCourses return nextcourses
# IMPLEMENT THIS IN JS! # IMPLEMENT THIS IN JS!
#def maxCreditsAllowed(): #def maxCreditsAllowed():
...@@ -219,20 +219,29 @@ def genTrajectories(taken, programs, user): ...@@ -219,20 +219,29 @@ def genTrajectories(taken, programs, user):
availableCourses=nextCourses(remainingCourses, taken) availableCourses=nextCourses(remainingCourses, taken)
semclasses=[] semclasses=[]
for i in xrange(5): for i in xrange(5):
doneclass = availableCourses.pop() try:
semclasses.append(doneclass) doneclass = availableCourses.pop()
taken.add(doneclass) semclasses.append(doneclass)
newsem = Semester(number=sem.number+1, user=user, courses=semclasses, taken.add(doneclass)
programs=programs) except:
tj.semesters.append(newsem) break
newsem = Semester(number=sem.number+1, user=user)
newsem.save()
newsem.courses = semclasses
newsem.programs = programs
newsem.save()
sem.nextsemester = newsem
#tj.semesters+=[newsem]
sem = newsem sem = newsem
failed=False failed=False
for program in programs: #for program in programs:
if requirementsFulfilled(program, taken) != program.requirements: # if requirementsFulfilled(taken, program) != program.requirements:
failed=True # failed=True
if not failed: #if not failed:
break # break
if enoughCredits(taken, 120):
break
return tj return tj
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment