Esempio n. 1
0
def whole_submission(assignment, username, by_section):
    """by_section should be True or False, whether or not to get the
    first/last by section or not"""
    solution = queries.get_submission(username, assignment)
    studentsolution = solution[0]
    autograder_output = solution[1]
    grade = solution[2]

    fullprevcomments = queries.get_all_past_comments()
    linenumbers = makelinenumbers(studentsolution)
    if(by_section):
        section = queries.get_section(username)
        students = queries.who_turned_in_by_section(assignment, section)
    else:
        students = queries.who_turned_in(assignment)
    p,n = find_prev_next(students, username)

    thecomments = dictify(queries.get_student_commentids(username, assignment))
    return template("grade_whole",
                    source=studentsolution,
                    past_comments=list(map(lambda pair: pair[1], fullprevcomments)),
                    existingcomments=thecomments,
                    linenumbers=linenumbers,
                    autograder=autograder_output,
                    student=username,
                    assignment=assignment,
                    nextstudent=n,
                    prevstudent=p,
                    default_grade=get_grade(username, assignment, None),
                    grades=possible_grades())
Esempio n. 2
0
def get_grade(username, assignment, problemname):
    """This method returns the grade given a username, assignment, and
    problemname. If you've graded this problem previously, we return
    the current grade.  This returns "A" if the autograder output
    returns True (or passed); else, return "F"."""

    if(problemname==None):
        ## This happens when grading a whole submission at once.
        solution = queries.get_submission(username, assignment)
    else:
        ## This happens if we're just grading a single problem.
        solution = queries.get_solution(username, assignment, problemname)

    if solution is None or solution[2] is None:
        grade = "?"
    else:
        grade = solution[2]
    assert grade in letter_grades_to_numbers.keys(), grade
    return grade