Add in a check function to see if students are allowed to submit peer grading
This commit is contained in:
@@ -73,6 +73,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
|
||||
self.send_to_grader(self.latest_answer(), system)
|
||||
self.created = False
|
||||
|
||||
|
||||
def _parse(self, oeparam, prompt, rubric, system):
|
||||
'''
|
||||
Parse OpenEndedResponse XML:
|
||||
|
||||
@@ -22,6 +22,7 @@ from xmodule.stringify import stringify_children
|
||||
from xmodule.xml_module import XmlDescriptor
|
||||
from xmodule.modulestore import Location
|
||||
from capa.util import *
|
||||
from peer_grading_service import PeerGradingService
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
@@ -104,7 +105,9 @@ class OpenEndedChild(object):
|
||||
# Used for progress / grading. Currently get credit just for
|
||||
# completion (doesn't matter if you self-assessed correct/incorrect).
|
||||
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)
|
||||
|
||||
def setup_response(self, system, location, definition, descriptor):
|
||||
@@ -408,3 +411,23 @@ class OpenEndedChild(object):
|
||||
success = True
|
||||
|
||||
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):
|
||||
count_graded = response['count_graded']
|
||||
count_required = response['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
|
||||
|
||||
score_dict = {
|
||||
|
||||
Reference in New Issue
Block a user