Commit 8d3f4932 by Vik Paruchuri

Add in checks to see if student can submit (ie needs to peer grade more or not)

parent 4237df62
......@@ -606,10 +606,15 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
success, get = self.append_image_to_student_answer(get)
error_message = ""
if success:
get['student_answer'] = OpenEndedModule.sanitize_html(get['student_answer'])
self.new_history_entry(get['student_answer'])
self.send_to_grader(get['student_answer'], system)
self.change_state(self.ASSESSING)
success, allowed_to_submit, error_message = self.check_if_student_can_submit()
if allowed_to_submit:
get['student_answer'] = OpenEndedModule.sanitize_html(get['student_answer'])
self.new_history_entry(get['student_answer'])
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
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."
......
......@@ -416,6 +416,7 @@ class OpenEndedChild(object):
location = self.system.location.url()
student_id = self.system.anonymous_student_id
success = False
allowed_to_submit = True
response = {}
try:
response = self.peer_gs.get_data_for_location(location, student_id)
......@@ -425,9 +426,10 @@ class OpenEndedChild(object):
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)
return success, False, error_message
return success, allowed_to_submit, error_message
if count_graded>=count_required:
return success, True, ""
return success, allowed_to_submit, ""
else:
return success, False, ""
allowed_to_submit = False
return success, allowed_to_submit, ""
......@@ -177,9 +177,14 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
# add new history element with answer and empty score and hint.
success, get = self.append_image_to_student_answer(get)
if success:
get['student_answer'] = SelfAssessmentModule.sanitize_html(get['student_answer'])
self.new_history_entry(get['student_answer'])
self.change_state(self.ASSESSING)
success, allowed_to_submit, error_message = self.check_if_student_can_submit()
if allowed_to_submit:
get['student_answer'] = SelfAssessmentModule.sanitize_html(get['student_answer'])
self.new_history_entry(get['student_answer'])
self.change_state(self.ASSESSING)
else:
#Error message already defined, so we can just pass
pass
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."
......
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