From 09ed3d12a29e61518f4a1cd57347714c326e8435 Mon Sep 17 00:00:00 2001 From: Diana Huang Date: Fri, 14 Dec 2012 12:00:42 -0500 Subject: [PATCH] Hook up the backend into the new feedback response for scores --- common/lib/capa/capa/responsetypes.py | 4 +++- common/lib/capa/capa/templates/openendedinput.html | 2 +- common/lib/xmodule/xmodule/js/src/capa/display.coffee | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py index e9a363adba..81843b6edf 100644 --- a/common/lib/capa/capa/responsetypes.py +++ b/common/lib/capa/capa/responsetypes.py @@ -1928,7 +1928,7 @@ class OpenEndedResponse(LoncapaResponse): Returns a boolean success/fail and an error message """ survey_responses=event_info['survey_responses'] - for tag in ['feedback', 'submission_id', 'grader_id']: + for tag in ['feedback', 'submission_id', 'grader_id', 'score']: if tag not in survey_responses: return False, "Could not find needed tag {0}".format(tag) try: @@ -1936,6 +1936,7 @@ class OpenEndedResponse(LoncapaResponse): submission_id=int(survey_responses['submission_id']) grader_id = int(survey_responses['grader_id']) feedback = str(survey_responses['feedback']) + score = int(survey_responses['score']) except: error_message="Could not parse submission id, grader id, or feedback from message_post ajax call." log.exception(error_message) @@ -1961,6 +1962,7 @@ class OpenEndedResponse(LoncapaResponse): 'feedback' : feedback, 'submission_id' : submission_id, 'grader_id' : grader_id, + 'score': score, 'student_info' : json.dumps(student_info), } diff --git a/common/lib/capa/capa/templates/openendedinput.html b/common/lib/capa/capa/templates/openendedinput.html index aff55d6740..27042fda85 100644 --- a/common/lib/capa/capa/templates/openendedinput.html +++ b/common/lib/capa/capa/templates/openendedinput.html @@ -34,7 +34,7 @@ Respond to Feedback
-

How accurate do you think this feedback is?

+

How accurate do you find this feedback?

  • diff --git a/common/lib/xmodule/xmodule/js/src/capa/display.coffee b/common/lib/xmodule/xmodule/js/src/capa/display.coffee index 441d8b7634..005840e9d3 100644 --- a/common/lib/xmodule/xmodule/js/src/capa/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/capa/display.coffee @@ -209,9 +209,11 @@ class @Problem fd.append('feedback', feedback) fd.append('submission_id', submission_id) fd.append('grader_id', grader_id) - if(!score || parseInt(score) == NaN) - @gentle_alert "You need to pick a rating to submit." + if(!score) + @gentle_alert "You need to pick a rating before you can submit." return + else + fd.append('score', score) settings =