Example #1
0
def statistics():
    text = db_queries.get_page_content('statistics')
    statistics = db_queries.get_users_statistics(current_user.primary_email, None)

    #get user id to pass to the template to build the link to the last correctly submitted exercise
    user_id = db_queries.get_user(current_user.primary_email).user_id
    link_dir = app.config['STORAGE_FOLDER']
    return render_template("statistics.html", text=text, statistics=statistics, link_dir=link_dir, user_id=user_id)
Example #2
0
def profile():
    text = db_queries.get_page_content('profile')
    if request.method == 'POST':
        #if the submit button was hit, loads the information into the form
        form = ProfileForm(request.form)
        if form.validate():
            #sends the user to the profile/edit profile page with updated information
            # if is_profile_changed(form):
            #     #user profile has been changed, update the database
            db_posts.update_profile(form, current_user.primary_email)
            text = db_queries.get_page_content('profile')
            profile = db_queries.get_profile(current_user.primary_email)
            return render_template("my_profile.html", text=text, profile=profile, form=form, leftProfileContent=profile)
        else:
            profile = db_queries.get_profile(current_user.primary_email)
            return render_template("my_profile.html", text=text, profile=profile, form=form, leftProfileContent=profile)

    #sends the user to the profile/edit profile page for GET methods
    profile = db_queries.get_profile(current_user.primary_email)
    form = ProfileForm(obj=profile)
    return render_template("my_profile.html", text=text, profile=profile, form=form, leftProfileContent=profile)
Example #3
0
def exercises():
    text = db_queries.get_page_content('exercises')
    exercise_list = db_queries.get_exercise_list()
    return render_template("exercises.html", text=text, leftPanelContent=exercise_list)
Example #4
0
def index():
    text = db_queries.get_page_content('index')
    return render_template("index.html", text=text)
def login():
    #displays the login links
    text = db_queries.get_page_content('login')
    return render_template("login.html", text=text)
def login():
    #displays the login links
    text = db_queries.get_page_content('login')
    return render_template("login.html", text=text)