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 )
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
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 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 )