Commit 5cf7441d by Vik Paruchuri

Fix error message passing to JS and student

parent 53028b46
...@@ -613,13 +613,13 @@ class OpenEndedModule(openendedchild.OpenEndedChild): ...@@ -613,13 +613,13 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
self.send_to_grader(get['student_answer'], system) self.send_to_grader(get['student_answer'], system)
self.change_state(self.ASSESSING) self.change_state(self.ASSESSING)
else: else:
#Error message already defined, so we can just pass it down the chain #Error message already defined
pass success = False
else: 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." 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 { return {
'success': True, 'success': success,
'error': error_message, 'error': error_message,
'student_response': get['student_answer'] 'student_response': get['student_answer']
} }
......
...@@ -418,18 +418,21 @@ class OpenEndedChild(object): ...@@ -418,18 +418,21 @@ class OpenEndedChild(object):
success = False success = False
allowed_to_submit = True allowed_to_submit = True
response = {} 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: try:
response = self.peer_gs.get_data_for_location(location, student_id) response = self.peer_gs.get_data_for_location(location, student_id)
count_graded = response['count_graded'] count_graded = response['count_graded']
count_required = response['count_required'] count_required = response['count_required']
student_sub_count = response['student_sub_count']
success = True success = True
except: except:
error_message = ("Need to peer grade more in order to make another submission. " error_message = "Could not contact the grading controller."
"You have graded {0}, {1} are required.").format(count_graded, count_required)
return success, allowed_to_submit, error_message return success, allowed_to_submit, error_message
if count_graded>=count_required: if count_graded>=count_required:
return success, allowed_to_submit, "" return success, allowed_to_submit, ""
else: else:
allowed_to_submit = False 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): ...@@ -183,11 +183,12 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
self.new_history_entry(get['student_answer']) self.new_history_entry(get['student_answer'])
self.change_state(self.ASSESSING) self.change_state(self.ASSESSING)
else: else:
#Error message already defined, so we can just pass #Error message already defined
pass success = False
else: 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." 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 { return {
'success': success, 'success': success,
'rubric_html': self.get_rubric_html(system), '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