Commit 4237df62 by Vik Paruchuri

Add in a check function to see if students are allowed to submit peer grading

parent 9ead4ebb
...@@ -73,6 +73,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild): ...@@ -73,6 +73,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
self.send_to_grader(self.latest_answer(), system) self.send_to_grader(self.latest_answer(), system)
self.created = False self.created = False
def _parse(self, oeparam, prompt, rubric, system): def _parse(self, oeparam, prompt, rubric, system):
''' '''
Parse OpenEndedResponse XML: Parse OpenEndedResponse XML:
......
...@@ -22,6 +22,7 @@ from xmodule.stringify import stringify_children ...@@ -22,6 +22,7 @@ from xmodule.stringify import stringify_children
from xmodule.xml_module import XmlDescriptor from xmodule.xml_module import XmlDescriptor
from xmodule.modulestore import Location from xmodule.modulestore import Location
from capa.util import * from capa.util import *
from peer_grading_service import PeerGradingService
from datetime import datetime from datetime import datetime
...@@ -104,7 +105,9 @@ class OpenEndedChild(object): ...@@ -104,7 +105,9 @@ class OpenEndedChild(object):
# Used for progress / grading. Currently get credit just for # Used for progress / grading. Currently get credit just for
# completion (doesn't matter if you self-assessed correct/incorrect). # completion (doesn't matter if you self-assessed correct/incorrect).
self._max_score = static_data['max_score'] self._max_score = static_data['max_score']
self.peer_gs = PeerGradingService(system.open_ended_grading_interface, system)
self.system = system
self.setup_response(system, location, definition, descriptor) self.setup_response(system, location, definition, descriptor)
def setup_response(self, system, location, definition, descriptor): def setup_response(self, system, location, definition, descriptor):
...@@ -408,3 +411,23 @@ class OpenEndedChild(object): ...@@ -408,3 +411,23 @@ class OpenEndedChild(object):
success = True success = True
return success, string return success, string
def check_if_student_can_submit(self):
location = self.system.location.url()
student_id = self.system.anonymous_student_id
success = False
response = {}
try:
response = self.peer_gs.get_data_for_location(location, student_id)
count_graded = response['count_graded']
count_required = response['count_required']
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)
return success, False, error_message
if count_graded>=count_required:
return success, True, ""
else:
return success, False, ""
...@@ -155,6 +155,7 @@ class PeerGradingModule(XModule): ...@@ -155,6 +155,7 @@ class PeerGradingModule(XModule):
count_graded = response['count_graded'] count_graded = response['count_graded']
count_required = response['count_required'] count_required = response['count_required']
if count_required > 0 and count_graded >= count_required: if count_required > 0 and count_graded >= count_required:
#Ensures that once a student receives a final score for peer grading, that it does not change.
self.student_data_for_location = response self.student_data_for_location = response
score_dict = { score_dict = {
......
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