def user_page():

    

if __name__ == "__main__":
    hackbright.connect_to_db(app)
    app.run(debug=True)
def get_student():
    hackbright.connect_to_db()
    student_github = request.args.get("github")
    row = hackbright.get_student_by_github(student_github)
    html = render_template("student_info.html",
                           first_name=row[0],
                           last_name=row[1],
                           github=row[2])
    return html
Example #3
0
def get_project1():
    hackbright.connect_to_db()
    title = request.args.get("get_project")
    row = hackbright.get_project(title)
    html = render_template("student_info.html",
                           id=row[0],
                           title=row[1],
                           description=row[2],
                           maxgrade=row[3])
    return html
Example #4
0
def get_student():
    hackbright.connect_to_db()
    student_github = request.args.get("github")
    fname, lname, gname = hackbright.get_student_by_github(student_github)
    grades = hackbright.show_all_grades(fname, lname)
    html = render_template("student_info.html",
                           first_name=fname,
                           last_name=lname,
                           github=gname,
                           grades=grades)

    return html
Example #5
0
def show_project():
    hackbright.connect_to_db()
    title = request.args.get("title")
    headers, students = hackbright.get_grades_by_project(title)
    # percentage = (students[2]/headers[1])

    html = render_template(
        "show_project.html",
        title=title,
        description=headers[0],
        max_grade=headers[1],
        students=students,
    )

    return html
    return render_template('display_new_student.html',
                           first_name=first_name,
                           last_name=last_name,
                           github=github)


# @app.route('/student-search', methods=["GET"])
# def show_new_student():

#     git_hub = request.form.get('github')
#     # added_student = get_student_by_github("github")
#     get_student_by_github("github")
#     print(added_student)

#     # html = render_template("add_new_student.html",
#     #                         last_name = added_student['last_name'],
#     #                         github=added_student['github'],
#     #                         first_name = added_student['first_name'],
#     #

#     html = render_template("add_new_student.html",
#                             last_name = last_name,
#                             github=github,
#                             first_name =first_name,)

#     return html

if __name__ == "__main__":
    hackbright.connect_to_db(app)
    app.run(debug=True)
    return render_template("student_info.html", first=first, last=last, github=github, grades=grades)


@app.route("/student-add")
def add_student_form():
    """Show a form to add a new student"""
    return render_template("student_add_form.html")


@app.route("/student-add-confirmation", methods=["POST"])
def confirm_student_add():
    """Show a confirmation that student has been added"""
    github = request.form.get("github", "jhacks")
    last = request.form.get("last", "Hacker")
    first = request.form.get("first", "Jane")
    confirmation_string = hackbright.make_new_student(first, last, github)
    return render_template("student_add_confirmation.html", confirmation_string=confirmation_string)

@app.route("/project/<string:title>")
def get_project_info(title):
    """Shows project info given the title"""

    id, title, desc, max_grade = hackbright.get_project_by_title(title)
    grades = hackbright.get_all_grades_by_project(title)
    return render_template("project_info.html", title=title, desc=desc, max_grade=max_grade, grades=grades)


if __name__ == "__main__":
    hackbright.connect_to_db(app)
    app.run(debug=True)
Example #8
0
def homepage():



@app.route("/student")
def get_student():
    """Show information about a student."""
    if request.args.get('github'):
        github = request.args.get('github')

        first, last, github = hackbright.get_student_by_github(github)
        project_grade_list = hackbright.get_grades_by_github(github)


        return render_template("student_info.html",
                            github=github, 
                            first=first, 
                            last=last,
                            project_grade_list=project_grade_list)
    else:
        return redirect('/student-search')

@app.route("/student-search")
def get_student_form():
    """Show form searching for a student."""

    return render_template("student_search.html")


@app.route("/student-add")
def student_add():
    """Add a student."""

    return render_template('new_student.html')

@app.route("/student-added", methods=['POST'])
def student_added():
    """Add a student."""

    first_name = request.form.get('first_name')
    last_name = request.form.get('last_name')
    github = request.form.get('github')

    hackbright.make_new_student(first_name, last_name, github)

    return render_template('student_added.html',
                            first_name = first_name,
                            last_name=last_name,
                            github=github)

@app.route("/project")
def list_project_details():
    """Listing title, description and max grade for a project"""
    title = request.args.get('title')
    project_list = hackbright.get_project_by_title(title)
    student_grades_list = hackbright.get_grades_by_title(title)

    print(student_grades_list)
    for student in student_grades_list:
        print('student', student[0], student[1])
    return render_template("project_page.html",
        project_list=project_list,
        student_grades_list=student_grades_list)
    

if __name__ == "__main__":
    hackbright.connect_to_db(app)
    app.run(debug=True)
    html = render_template("student_added.html", github=github)

    return html


@app.route("/project")
def project_info():
    """Link to information about a project."""

    title = request.args.get('title')

    title, description, max_grade = hb.get_project_by_title(title)

    students = hb.get_project_student_and_grade(title)

    print("STUDENTS: ", students)

    html = render_template("project_info.html",
                           title=title,
                           description=description,
                           max_grade=max_grade,
                           students=students)

    return html


if __name__ == "__main__":
    hb.connect_to_db(app)
    app.run(debug=True)