示例#1
0
def grade(username, assignment, problemname):
    solution = queries.get_solution(username, assignment, problemname)
    studentsolution = solution[0]
    autograder_output = solution[1]
    grade = solution[2]

    fullprevcomments = queries.get_all_past_comments()
    linenumbers = makelinenumbers(studentsolution)
    commenttext = queries.get_comments(username, assignment, problemname)
    students = queries.get_usernames(assignment, problemname)
    p,n = find_prev_next(students, username)
    
    return template("gradeoneproblem",
                    source=studentsolution,
                    existingcomments=commenttext,
                    linenumbers=linenumbers,
                    past_comments=list(map(lambda pair: pair[1], fullprevcomments)),
                    autograder=autograder_output,
                    student=username,
                    assignment=assignment,
                    problem=problemname,
                    nextstudent=n,
                    prevstudent=p,
                    default_grade=get_grade(username, assignment, problemname), 
                    grades=possible_grades())
示例#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
示例#3
0
def get_solution(room_id):
    return jsonify(queries.get_solution(room_id))