diff --git a/lms/djangoapps/open_ended_grading/peer_grading_service.py b/lms/djangoapps/open_ended_grading/peer_grading_service.py index 9ef0383fb5..ce89448374 100644 --- a/lms/djangoapps/open_ended_grading/peer_grading_service.py +++ b/lms/djangoapps/open_ended_grading/peer_grading_service.py @@ -190,7 +190,7 @@ def get_next_submission(request, course_id): mimetype="application/json") except GradingServiceError: log.exception("Error getting next submission. server url: {0} location: {1}, grader_id: {2}" - .format(staff_grading_service().url, location, grader_id)) + .format(peer_grading_service().url, location, grader_id)) return json.dumps({'success': False, 'error': 'Could not connect to grading service'}) @@ -228,7 +228,7 @@ def save_grade(request, course_id): except GradingServiceError: log.exception("""Error saving grade. server url: {0}, location: {1}, submission_id:{2}, submission_key: {3}, score: {4}""" - .format(staff_grading_service().url, + .format(peer_grading_service().url, location, submission_id, submission_key, score) ) return json.dumps({'success': False, @@ -267,7 +267,7 @@ def is_student_calibrated(request, course_id): return HttpResponse(response, mimetype="application/json") except GradingServiceError: log.exception("Error from grading service. server url: {0}, grader_id: {0}, location: {1}" - .format(staff_grading_service().url, grader_id, location)) + .format(peer_grading_service().url, grader_id, location)) return json.dumps({'success': False, 'error': 'Could not connect to grading service'}) @@ -308,12 +308,30 @@ def show_calibration_essay(request, course_id): location = p['location'] try: response = peer_grading_service().show_calibration_essay(location, grader_id) - return HttpResponse(response, mimetype="application/json") + response_json = json.loads(response) + # if we can't handle the rubric + if response_json.has_key('rubric'): + rubric = response_json['rubric'] + rubric_renderer = CombinedOpenEndedRubric(False) + success, rubric_html = rubric_renderer.render_rubric(rubric) + if not success: + error_message = "Could not render rubric: {0}".format(rubric) + log.exception(error_message) + return json.dumps({'success': False, + 'error': error_message}) + response_json['rubric'] = rubric_html + return json.dumps(response_json) except GradingServiceError: log.exception("Error from grading service. server url: {0}, location: {0}" - .format(staff_grading_service().url, location)) + .format(peer_grading_service().url, location)) return json.dumps({'success': False, 'error': 'Could not connect to grading service'}) + # if we can't parse the rubric into HTML, + except etree.XMLSyntaxError: + log.exception("Cannot parse rubric string. Raw string: {0}" + .format(rubric)) + return json.dumps({'success': False, + 'error': 'Error displaying submission'}) def save_calibration_essay(request, course_id): diff --git a/lms/djangoapps/open_ended_grading/staff_grading_service.py b/lms/djangoapps/open_ended_grading/staff_grading_service.py index f417ca026e..b988a3548c 100644 --- a/lms/djangoapps/open_ended_grading/staff_grading_service.py +++ b/lms/djangoapps/open_ended_grading/staff_grading_service.py @@ -50,9 +50,9 @@ class MockStaffGradingService(object): self.cnt += 1 return json.dumps({'success': True, 'problem_list': [ - json.dumps({'location': 'i4x://MITx/3.091x/problem/open_ended_demo1', \ + json.dumps({'location': 'i4x://MITx/3.091x/problem/open_ended_demo1', 'problem_name': "Problem 1", 'num_graded': 3, 'num_pending': 5, 'min_for_ml': 10}), - json.dumps({'location': 'i4x://MITx/3.091x/problem/open_ended_demo2', \ + json.dumps({'location': 'i4x://MITx/3.091x/problem/open_ended_demo2', 'problem_name': "Problem 2", 'num_graded': 1, 'num_pending': 5, 'min_for_ml': 10}) ]}) diff --git a/lms/static/coffee/src/peer_grading/peer_grading_problem.coffee b/lms/static/coffee/src/peer_grading/peer_grading_problem.coffee index e294c50f7c..548a3f3db3 100644 --- a/lms/static/coffee/src/peer_grading/peer_grading_problem.coffee +++ b/lms/static/coffee/src/peer_grading/peer_grading_problem.coffee @@ -56,13 +56,41 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t
This is a self-assessed open response question. Please use as much space as you need in the box below to answer the question.
''' rubric: ''' -Please score your response according to how many of the above components you identified:
+| Purpose | + ++ + | + ++ + | + ++ + | + ++ + | +
|---|---|---|---|---|
| Organization | + ++ + | + ++ + | + ++ + | + ++ + | +
This is a self-assessed open response question. Please use as much space as you need in the box below to answer the question.
''' rubric: ''' -Please score your response according to how many of the above components you identified:
+| Purpose | + ++ + | + ++ + | + ++ + | + ++ + | +
|---|---|---|---|---|
| Organization | + ++ + | + ++ + | + ++ + | + ++ + | +
Choose an overall score for this submission.
+ """) # Now create new labels and inputs for each possible score. for score in [0..max_score] @@ -375,12 +458,13 @@ class PeerGradingProblem label = """""" input = """ - + """ # " fix broken parsing in emacs @score_selection_container.append(input + label) # And now hook up an event handler again $("input[name='score-selection']").change @graded_callback + $("input[name='grade-selection']").change @graded_callback diff --git a/lms/static/coffee/src/staff_grading/staff_grading.coffee b/lms/static/coffee/src/staff_grading/staff_grading.coffee index 3274f2048c..a9e70f7e75 100644 --- a/lms/static/coffee/src/staff_grading/staff_grading.coffee +++ b/lms/static/coffee/src/staff_grading/staff_grading.coffee @@ -45,43 +45,35 @@ The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for t| Purpose | - | - | - | - |
|---|---|---|---|---|
| Organization | - | - | - | - |