def InstructorByDepartment(Department): # Place holder lists #Teachers = set([''.join([i[0], i[1]]) for i in getProfReviews('', '',Options[3][Department], '')]) Teachers = sorted([prof for prof in ProfDepartments if Options[3][Department] in ProfDepartments[prof]]) Teachers_Sorted = Sort_dict(Teachers, False) Best_Professors = bestProf(Options[3][Department]) Best_Teachers,Best_Teachers_Sorted = bestProf(Options[3][Department])#Best_Professors[0], Best_Professors[1] Easiest_Teachers,Easiest_Teachers_Sorted = easiestProf(Options[3][Department]) Best_Classes,Best_Classes_Sorted = bestClass(Options[3][Department]) Crn_and_Term = {} for course in Best_Classes_Sorted: Course = getClassReviews('', course)[0][0] Crn_and_Term[Course[2]] = ((Course[-2], Course[-1])) Easiest_Classes,Easiest_Classes_Sorted = easiestClass(Options[3][Department]) DepartmentOptions = Options[3] for option in DepartmentOptions: if DepartmentOptions[option] == Department: Department = option return render_template('Department.html',Teachers_Sorted = Teachers_Sorted,Best_Teachers_Sorted = Best_Teachers_Sorted,Best_Teachers = Best_Teachers, Easiest_Teachers = Easiest_Teachers,Easiest_Teachers_Sorted = Easiest_Teachers_Sorted, Department = Department,Teachers = Teachers, Best_Classes = Best_Classes,Best_Classes_Sorted = Best_Classes_Sorted,Easiest_Classes = Easiest_Classes, Easiest_Classes_Sorted = Easiest_Classes_Sorted ,Crn_and_Term = Crn_and_Term)
def classInfo(class_info): CourseRatings = calculateClassRatings(getClassReviews('', class_info)) Course_text_review = str(CourseRatings[3]) toughness = str(CourseRatings[4]) interest = str(CourseRatings[5]) Textbook = str(CourseRatings[6]) return render_template('class_info.html', Textbook = Textbook, interest = interest,toughness = toughness,Course_text_review = Course_text_review )
def DisplayClassPage(Class, CRN, Term): CourseName = Class Descriptions = GetClassDescriptionAndAll(CRN, Term) CourseDescription = Descriptions[0] CourseRatings = calculateClassRatings(getClassReviews('', Class)) toughness = CourseRatings[3] interest = CourseRatings[4] Textbook = CourseRatings[5] if type(toughness) == str: Overall_Rating = '' else: Overall_Rating = (toughness + interest) / 2.0 Prerequisites = '' Corequisites = '' if Descriptions[1] == "Corequisite Only": Corequisites = Descriptions[2] Attributes = Descriptions[3] Restrictions = Descriptions[4] elif Descriptions[1] == "Both": Prerequisites = Descriptions[2] Corequisites = Descriptions[3] Attributes = Descriptions[4] Restrictions = Descriptions[5] elif Descriptions[1] == 'Prerequisite Only': Prerequisites = Descriptions[2] Attributes = Descriptions[3] Restrictions = Descriptions[4] else: Attributes = Descriptions[2] Restrictions = Descriptions[3] Restrictions = ["Must " + i for i in Restrictions.split("Must")[1:]] return render_template('class_info.html',Restrictions = Restrictions, Overall_Rating = Overall_Rating,Prerequisites = Prerequisites, Corequisites = Corequisites, CourseName = CourseName, CourseDescription = CourseDescription, Textbook = Textbook, interest = interest,toughness = toughness, Attributes = Attributes )
def classInfo(class_info): CourseRatings = calculateClassRatings(getClassReviews('', class_info)) Course_text_review = str(CourseRatings[3]) toughness = str(CourseRatings[4]) interest = str(CourseRatings[5]) Textbook = str(CourseRatings[6]) return render_template('class_info.html', Textbook=Textbook, interest=interest, toughness=toughness, Course_text_review=Course_text_review)
def DisplayClassPage(Class, CRN, Term): CourseName = Class Descriptions = GetClassDescriptionAndAll(CRN, Term) CourseDescription = Descriptions[0] CourseRatings = calculateClassRatings(getClassReviews('', Class)) toughness = CourseRatings[3] interest = CourseRatings[4] Textbook = CourseRatings[5] if type(toughness) == str: Overall_Rating = '' else: Overall_Rating = (toughness + interest) / 2.0 Prerequisites = '' Corequisites = '' if Descriptions[1] == "Corequisite Only": Corequisites = Descriptions[2] Attributes = Descriptions[3] Restrictions = Descriptions[4] elif Descriptions[1] == "Both": Prerequisites = Descriptions[2] Corequisites = Descriptions[3] Attributes = Descriptions[4] Restrictions = Descriptions[5] elif Descriptions[1] == 'Prerequisite Only': Prerequisites = Descriptions[2] Attributes = Descriptions[3] Restrictions = Descriptions[4] else: Attributes = Descriptions[2] Restrictions = Descriptions[3] Restrictions = ["Must " + i for i in Restrictions.split("Must")[1:]] return render_template('class_info.html', Restrictions=Restrictions, Overall_Rating=Overall_Rating, Prerequisites=Prerequisites, Corequisites=Corequisites, CourseName=CourseName, CourseDescription=CourseDescription, Textbook=Textbook, interest=interest, toughness=toughness, Attributes=Attributes)
def InstructorByDepartment(Department): # Place holder lists #Teachers = set([''.join([i[0], i[1]]) for i in getProfReviews('', '',Options[3][Department], '')]) Teachers = [ prof for prof in ProfDepartments if Options[3][Department] in ProfDepartments[prof] ] Teachers_Sorted = Sort_dict(Teachers, False) Best_Professors = bestProf(Options[3][Department]) Best_Teachers, Best_Teachers_Sorted = bestProf( Options[3][Department]) #Best_Professors[0], Best_Professors[1] Easiest_Teachers, Easiest_Teachers_Sorted = easiestProf( Options[3][Department]) Best_Classes, Best_Classes_Sorted = bestClass(Options[3][Department]) Crn_and_Term = {} for course in Best_Classes_Sorted: Course = getClassReviews('', course)[0][0] Crn_and_Term[Course[2]] = ((Course[-2], Course[-1])) Easiest_Classes, Easiest_Classes_Sorted = easiestClass( Options[3][Department]) DepartmentOptions = Options[3] for option in DepartmentOptions: if DepartmentOptions[option] == Department: Department = option return render_template('Department.html', Teachers_Sorted=Teachers_Sorted, Best_Teachers_Sorted=Best_Teachers_Sorted, Best_Teachers=Best_Teachers, Easiest_Teachers=Easiest_Teachers, Easiest_Teachers_Sorted=Easiest_Teachers_Sorted, Department=Department, Teachers=Teachers, Best_Classes=Best_Classes, Best_Classes_Sorted=Best_Classes_Sorted, Easiest_Classes=Easiest_Classes, Easiest_Classes_Sorted=Easiest_Classes_Sorted, Crn_and_Term=Crn_and_Term)
def DisplayClassPage(Class, CRN, Term): CourseName = Class Descriptions = GetClassDescriptionAndAll(CRN, Term) CourseDescription = Descriptions[0] Reviews = getClassReviews('', Class) CourseRatings = calculateClassRatings(Reviews) CourseTextReviews = [review[3] for review in Reviews [0] if review[3] != ''] toughness = CourseRatings[3] interest = CourseRatings[4] Textbook = CourseRatings[5] if type(toughness) == str: Overall_Rating = '' else: Overall_Rating = round((toughness + interest) / 2.0, 2) # Round numbers if type(toughness) == float: toughness = round(toughness,2) if type(interest) == float: interest = round(interest,2) if type(Textbook) == float: Textbook = round(Textbook,2) Prerequisites = '' Corequisites = '' if Descriptions[1] == "Corequisite Only": Corequisites = Descriptions[2] Attributes = Descriptions[3] Restrictions = Descriptions[4] Registration = Descriptions[5] CrossListed = Descriptions[6] elif Descriptions[1] == "Both": Prerequisites = Descriptions[2] Corequisites = Descriptions[3] Attributes = Descriptions[4] Restrictions = Descriptions[5] Registration = Descriptions[6] CrossListed = Descriptions[7] elif Descriptions[1] == 'Prerequisite Only': Prerequisites = Descriptions[2] Attributes = Descriptions[3] Restrictions = Descriptions[4] Registration = Descriptions[5] CrossListed = Descriptions[6] else: Attributes = Descriptions[2] Restrictions = Descriptions[3] Registration = Descriptions[4] CrossListed = Descriptions[5] Restrictions = ["Must " + i for i in Restrictions.split("Must")[1:]] Remaining = Registration.split("TOTAL")[1] Remaining = Remaining.split("\n")[1:-1] # Spots = [] # if CrossListed: # CrossListed = CrossListed.split("\n\n\n")[1:-1] # temp = [] # for i in CrossListed: # data = i.split("\n") # Spots.append(data[2:]) # courseName = data[0] return render_template('class_info.html',CourseTextReviews = CourseTextReviews,CrossListed = CrossListed ,Registration = Remaining, Restrictions = Restrictions, Overall_Rating = Overall_Rating,Prerequisites = Prerequisites, Corequisites = Corequisites, CourseName = CourseName, CourseDescription = CourseDescription, Textbook = Textbook, interest = interest,toughness = toughness, Attributes = Attributes )