Commit adbfdcce by Vik Paruchuri

Prevent student from resetting problem unless they have completed required peer…

Prevent student from resetting problem unless they have completed required peer grading.  Grant an exemption if there is no available peer grading.
parent e39abe11
......@@ -516,6 +516,7 @@ class CombinedOpenEndedV1Module():
count_graded = response['count_graded']
count_required = response['count_required']
student_sub_count = response['student_sub_count']
count_available = response['count_available']
success = True
except:
# This is a dev_facing_error
......@@ -524,7 +525,7 @@ class CombinedOpenEndedV1Module():
# This is a student_facing_error
error_message = "Could not contact the graders. Please notify course staff."
return success, allowed_to_submit, error_message
if count_graded >= count_required:
if count_graded >= count_required or count_available==0:
return success, allowed_to_submit, ""
else:
allowed_to_submit = False
......@@ -687,7 +688,9 @@ class CombinedOpenEndedV1Module():
if self.state != self.DONE:
if not self.ready_to_reset:
return self.out_of_sync_error(data)
success, can_reset, error = self.check_if_student_has_done_needed_grading()
if not can_reset:
return {'error' : error, 'success' : False}
if self.student_attempts >= self.max_attempts-1:
if self.student_attempts==self.max_attempts-1:
self.student_attempts +=1
......
......@@ -124,4 +124,4 @@ class MockPeerGradingService(object):
]}
def get_data_for_location(self, problem_location, student_id):
return {"version": 1, "count_graded": 3, "count_required": 3, "success": True, "student_sub_count": 1}
return {"version": 1, "count_graded": 3, "count_required": 3, "success": True, "student_sub_count": 1, 'submissions_available' : 0}
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