Commit af6123a1 by Vik Paruchuri

Add in methods to query data from the controller for student grading

parent 4c5e59e8
...@@ -135,12 +135,42 @@ class PeerGradingModule(XModule): ...@@ -135,12 +135,42 @@ class PeerGradingModule(XModule):
return json.dumps(d, cls=ComplexEncoder) return json.dumps(d, cls=ComplexEncoder)
def query_data_for_location(self):
student_id = self.system.anonymous_student_id
location = self.system.location
success = False
response = {}
try:
response = self.peer_gs.get_data_for_location(location, grader_id)
count_graded = response['count_graded']
count_required = response['count_required']
success = True
except GradingServiceError:
log.exception("Error getting location data from controller for location {0}, student {1}"
.format(location, student_id))
return success, response
def get_progress(self): def get_progress(self):
pass pass
def get_score(self): def get_score(self):
pass if not self.use_for_single_location:
return None
try:
count_graded = self.student_data_for_location['count_graded']
count_required = self.student_data_for_location['count_required']
except:
success, response = self.query_data_for_location()
if not success:
log.exception("No instance data found and could not get data from controller for loc {0} student {1}".format(
self.system.location, self.system.anonymous_student_id
))
return None
def max_score(self): def max_score(self):
''' Maximum score. Two notes: ''' Maximum score. Two notes:
...@@ -148,9 +178,8 @@ class PeerGradingModule(XModule): ...@@ -148,9 +178,8 @@ class PeerGradingModule(XModule):
randomization, and 5/7 on another randomization, and 5/7 on another
''' '''
max_score = None max_score = None
if self.check_if_done_and_scored(): if self.use_for_single_location:
last_response = self.get_last_response(self.current_task_number) max_score = self.max_score
max_score = last_response['max_score']
return max_score return max_score
def get_next_submission(self, get): def get_next_submission(self, get):
......
...@@ -38,7 +38,7 @@ class PeerGradingService(): ...@@ -38,7 +38,7 @@ class PeerGradingService():
def get_data_for_location(self, problem_location, student_id): def get_data_for_location(self, problem_location, student_id):
response = self.get(self.get_data_for_location_url, response = self.get(self.get_data_for_location_url,
{'location': problem_location, 'student_id': student_id}) {'location': problem_location, 'student_id': student_id})
return self._render_rubric(response) return response
def get_next_submission(self, problem_location, grader_id): def get_next_submission(self, problem_location, grader_id):
response = self.get(self.get_next_submission_url, response = self.get(self.get_next_submission_url,
......
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