Commit 4ab43c3f authored by Daniel W Bond's avatar Daniel W Bond
Browse files

top trajectories function

parent 23a9e72c
from django.shortcuts import render, render_to_response
from trajectories.models import Course, Trajectory, Student
from django.db.models import Max
# other functions
......@@ -39,6 +40,8 @@ def nextCourses(coursesTaken, remainingReqCourses):
# this algorithm sucks because if there's a change to the number of allowed
# majors then this will break
def getGenEds(programs, isHonors):
""" returns the gen eds a student has to take based on their selected
programs """
genEdList = []
if isHonors:
......@@ -56,6 +59,7 @@ def getGenEds(programs, isHonors):
return genEdList
def maxProgramsAllowed(programList, maxProgramNumber):
""" called to ensure student can't sign up for more than 2 majors, etc """
if (len(programList) + 1) > maxProgramNumer:
return False
......@@ -73,21 +77,34 @@ def fulfilledReq(coursesTaken, courseCollection, numReq):
courseCollection.isCompleted = True
# how does one deal with "you have to take the coreq at the same time?"
def topTrajectories(trajectories):
""" Only shows the uppermost level of trajectories--
there's no reason that *all* of the previously loaded classes
need be gone through; furthermore, students only need to see
the top level of each of their trajectories on their homepage """
names = set()
for trajectory in trajectories:
topTrajectories = []
# trajectories take trajectories
# representing how you build up semester by semester
# find the one on the top of the pile
for name in names:
namedTrajectories = trajectories.filter(name = name)
topNamedTrajectory = namedTrajectories.aggregate(Max('semester'))
return topTrajectories
def enoughCourses(coursesTaken):
""" required credits for degree program """
if len(coursesTaken) > 120:
return True
return False
# how does one deal with "you have to take the coreq at the same time?"
# page render functions
# homepage, sign in to save or compare multiple options
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