예제 #1
0
def grade_add():

    name = request.form.get("name")
    project = request.form.get("project")
    grade = request.form.get("grade")

    first_name, last_name = name.split()
    github = hackbright.get_github_by_student(first_name, last_name)
    hackbright.assign_grade(github, project, grade)
def assign_grades_project():

    github = request.form.get('github')
    project = request.form.get('project')
    grade = request.form.get('grade')

    hackbright.assign_grade(github, project, grade)
    flash("The student's grade has been successfully added.")
    return redirect("/home")
def post_grades():
    """Assign new grades to the hackbright db"""

    grade = request.form.get('grade')
    title = request.form.get('title')
    github = request.form.get('github')

    hackbright.assign_grade(github, title, grade)

    return redirect('/project/' + title)
예제 #4
0
def assign_grade():
    github = request.form.get("github")
    project_title = request.form.get("title")
    grade = request.form.get("grade")

    if not (hackbright.get_grade_by_github_title(github, project_title)):
        hackbright.assign_grade(github, project_title, grade)
        return redirect('/')
    else:
        hackbright.update_grade(github, project_title, grade)
        return redirect('/')
예제 #5
0
def add_new_grade():
    """ add new grade to grades table in hackbright db"""

    student = request.form["student"]
    project_title = request.form["project"]
    grade = request.form["grade"]

    student_grade = hackbright.get_grade_by_github_title(
        student, project_title)

    if student_grade is None:
        hackbright.assign_grade(student, project_title, grade)
예제 #6
0
def assign_grade():
	"""assign project and grade to student"""
	github = request.form.get("github")
	title = request.form.get("title")
	grade = request.form.get("grade")
	student = hackbright.get_student_by_github(github)
	if student:
		hackbright.assign_grade(github, title, grade)
		flash('Grades have been added for ' + github)
		return redirect("/")
	else: 
		flash('There is no student with that name in our records')
		return redirect("/assign-grade")							
def add_grade():
    """Adds or updates students grade on a given project"""

    github = request.form.get('student')
    title = request.form.get('project')
    grade = request.form.get('grade')

    hackbright.assign_grade(github, title, grade)

    return render_template("confirm_grade.html",
                           title=title,
                           github=github,
                           grade=grade)
def give_grade():
    """Assign grade or update grade to student"""

    github = request.form.get("github")
    title = request.form.get("title")
    grade = request.form.get("grade")

    hackbright.assign_grade(github, title, grade)

    return render_template("graded.html",
                           github=github,
                           title=title,
                           grade=grade)
def add_grade():
    """Add or update a grade"""

    github = request.form.get('student')
    title = request.form.get('project')
    grade = request.form.get('grade')

    if hackbright.get_grade_by_github_title(github, title):
        hackbright.assign_grade(github, title, grade)
    else:
        hackbright.update_grade(github, title, grade)

    return redirect("/")
def grade_add():
    """Add grade to database and display confirmation"""

    github = request.form.get('student')
    title = request.form.get('project')
    grade = request.form.get('grade')

    hackbright.assign_grade(github, title, grade)

    return render_template("grade_added.html",
                           github=github,
                           title=title,
                           grade=grade)
예제 #11
0
def assign_student_grade():
    """Update database with student grade on project"""

    student = request.form.get('student')
    project = request.form.get('project')
    grade = request.form.get('grade')

    if hackbright.get_grade_by_github_title(student, project) is not None:
        hackbright.update_grade(student, project, grade)

    else:
        hackbright.assign_grade(student, project, grade)

    return redirect('/student?github={student}'.format(student=student))
def assign_grade():
    title = request.form.get('title')
    github = request.form.get('github')
    grade = request.form.get('grade')

    current_grade = hackbright.get_grade_by_github_title(github, title)

    if not current_grade:
        hackbright.assign_grade(github, title, grade)
        flash(f"Grade added")
    else:
        hackbright.update_grade(github, title, grade)
        flash(f"Grade updated")

    return redirect('/')
예제 #13
0
def set_grades():
    """Add new grade to database"""

    github = request.form.get('student')
    title = request.form.get('project')
    grade = request.form.get('grade')

    grades = hackbright.get_grades_by_title(title)

    for grade in grades:
        if github in grade:
            hackbright.update_grade(github, title, grade)
        else:
            hackbright.assign_grade(github, title, grade)

    return redirect("/")
def grade_added():
    """Show information about added grade."""
    student = request.form.get("student")
    project = request.form.get("project")
    grade = request.form.get("grade")

    github_tup = hackbright.get_github_by_id(student)
    github = github_tup[0]

    if hackbright.get_grade_by_github_title(github, project):
        hackbright.update_grade_by_github_title(github, project, grade)
        flash('Grade successfully updated.')
    else:
        hackbright.assign_grade(github, project, grade)
        flash('Grade successfully added.')

    return redirect("/grade-add")
예제 #15
0
def grade_add():
    """ Add grade """
    student = request.form.get("student")
    title = request.form.get("project")
    grade = request.form.get("grade")

    result = hackbright.get_grade_by_github_title(student, title)

    if result:
        hackbright.db.session.execute("""UPDATE grades
                                      SET grade={}
                                      WHERE student_github='{}'
                                      AND project_title='{}'""".format(grade, student, title))
        db.session.commit()
    else:
        hackbright.assign_grade(student, title, grade)

    flash("Grade successfully assigned.")
    return redirect("/")
예제 #16
0
def set_grades():
    """Add new grade to database"""

    github = request.form.get('student')
    title = request.form.get('project')
    grade = request.form.get('grade')

    grades = hackbright.get_grades_by_title(title)

    # grades = list of tuples [ ('project', grade), etc.]

    if grades:
        for student_grade in grades:
            import pdb
            pdb.set_trace()
            if github == student_grade[0]:
                print "I'm in the if statement"
                hackbright.update_grade(github, title, grade)
                return redirect("/")
    hackbright.assign_grade(github, title, grade)
    return redirect("/")