def get_student(): hackbright_app.connect_to_db() student_github = request.args.get("github") row = hackbright_app.get_student_by_github(student_github) first_name = row[0] last_name = row[1] grades = hackbright_app.show_grades(first_name,last_name) print grades # project_names, grades = zip(*grades) html = render_template("index.html", first_name = row[0], last_name = row[1], github = row[2], grades = grades # project_names = project_names ) # def list_project_grades(): # hackbright_app return html
def get_student(): hackbright_app.connect_to_db() student_github = request.args.get("github") row = hackbright_app.get_student_by_github(student_github) chart = hackbright_app.show_grades(student_github) html = render_template("student_info.html", first_name=row[0], last_name=row[1], github=row[2], projects=chart) return html
def get_student(): hackbright_app.connect_to_db() student_github = request.args.get("github") rows = hackbright_app.show_grades(student_github) html = render_template("student_info.html", rows = rows, last_name = rows[0][1], first_name = rows[0][0]) return html
def get_student(): hackbright_app.connect_to_db() student_name = request.args.get("student_name").split() list_of_rows = hackbright_app.show_grades(student_name[0], student_name[1]) if list_of_rows == []: return render_template("index.html") return render_template("student_info.html", first_name=student_name[0], last_name = student_name[1], list_of_rows = list_of_rows)
def get_student(): hackbright_app.connect_to_db() student_github = request.args.get("github") rows = hackbright_app.show_grades(student_github) html = render_template("student_info.html", rows=rows, last_name=rows[0][1], first_name=rows[0][0]) return html
def get_student(): """Gets the student's name and grades by their github account, displays them on a new page""" hackbright_app.connect_to_db() student_github = request.args.get("github") student_info = hackbright_app.get_student_by_github(student_github) dict_of_grades = hackbright_app.show_grades(student_github) html = render_template('student_info.html', first_name=student_info["first_name"], last_name=student_info["last_name"], github=student_info["github"], projects_and_grades = dict_of_grades) return html
def get_student(): hackbright_app.connect_to_db() student_github = request.args.get("github") row = hackbright_app.get_student_by_github(student_github) first_name = row[0] last_name = row[1] github = row[2] grades = hackbright_app.show_grades(first_name, last_name) html = render_template('student_info.html', first_name=first_name, last_name=last_name, github=github, grades=grades, ) return html
def show_grades(): hackbright_app.connect_to_db() first_name = request.args.get("first_name") output = hackbright_app.show_grades(first_name) """Stopped here. Read up on loops in Jinja; put a Jinja loop in grade_info.html. """ l = {"grade": } for elt in output: l[grade] = elt[0] l[max_grade] = elt[1] l[project_title] = elt[2] html.append(render_template("grades_info.html",l) return ## if __name__ == "__main__": app.run(debug=True)
def get_student(): hackbright_app.connect_to_db() student_github = request.args.get("github") row = hackbright_app.get_student_by_github(student_github) grades = hackbright_app.show_grades(row[0], row[1]) #Initialize an empty dictionary to send this particular students grades #to the template studentgrades = {} #Unpack the project, grade into the dictionary as key, value pairs for grade in grades: studentgrades[grade[2]] = grade[3] html = render_template("student_info.html", first_name=row[0], last_name=row[1], github=row[2], grade = studentgrades) return html