Commit 5cf7441d by Vik Paruchuri

Fix error message passing to JS and student

parent 53028b46
......@@ -613,13 +613,13 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
self.send_to_grader(get['student_answer'], system)
self.change_state(self.ASSESSING)
else:
#Error message already defined, so we can just pass it down the chain
pass
#Error message already defined
success = False
else:
error_message = "There was a problem saving the image in your submission. Please try a different image, or try pasting a link to an image into the answer box."
return {
'success': True,
'success': success,
'error': error_message,
'student_response': get['student_answer']
}
......
......@@ -418,18 +418,21 @@ class OpenEndedChild(object):
success = False
allowed_to_submit = True
response = {}
error_string = ("You need to peer grade more in order to make another submission. "
"You have graded {0}, and {1} are required. You have made {2} successful peer grading submissions.")
try:
response = self.peer_gs.get_data_for_location(location, student_id)
count_graded = response['count_graded']
count_required = response['count_required']
student_sub_count = response['student_sub_count']
success = True
except:
error_message = ("Need to peer grade more in order to make another submission. "
"You have graded {0}, {1} are required.").format(count_graded, count_required)
error_message = "Could not contact the grading controller."
return success, allowed_to_submit, error_message
if count_graded>=count_required:
return success, allowed_to_submit, ""
else:
allowed_to_submit = False
return success, allowed_to_submit, ""
error_message = error_string.format(count_graded, count_required, student_sub_count)
return success, allowed_to_submit, error_message
......@@ -183,11 +183,12 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
self.new_history_entry(get['student_answer'])
self.change_state(self.ASSESSING)
else:
#Error message already defined, so we can just pass
pass
#Error message already defined
success = False
else:
error_message = "There was a problem saving the image in your submission. Please try a different image, or try pasting a link to an image into the answer box."
log.debug(error_message)
return {
'success': success,
'rubric_html': self.get_rubric_html(system),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment