Commit fe86c25f by Diana Huang

Bug fixes for the JS and the peer grading service

parent 28501ca5
...@@ -33,12 +33,13 @@ class PeerGradingService(GradingService): ...@@ -33,12 +33,13 @@ class PeerGradingService(GradingService):
{'location': problem_location, 'grader_id': grader_id}) {'location': problem_location, 'grader_id': grader_id})
return response return response
def save_grade(self, grader_id, submission_id, score, feedback, submission_key): def save_grade(self, location, grader_id, submission_id, score, feedback, submission_key):
data = {'grader_id' : grader_id, data = {'grader_id' : grader_id,
'submission_id' : submission_id, 'submission_id' : submission_id,
'score' : score, 'score' : score,
'feedback' : feedback, 'feedback' : feedback,
'submission_key': submission_key} 'submission_key': submission_key,
'location': location}
return self.post(self.save_grade_url, False, data) return self.post(self.save_grade_url, False, data)
def is_student_calibrated(self, problem_location, grader_id): def is_student_calibrated(self, problem_location, grader_id):
...@@ -61,7 +62,6 @@ class PeerGradingService(GradingService): ...@@ -61,7 +62,6 @@ class PeerGradingService(GradingService):
def get_problem_list(self, course_id, grader_id): def get_problem_list(self, course_id, grader_id):
params = {'course_id': course_id, 'student_id': grader_id} params = {'course_id': course_id, 'student_id': grader_id}
response = self.get(self.get_problem_list_url, False, params) response = self.get(self.get_problem_list_url, False, params)
log.debug("Response! {0}".format(response))
return response return response
...@@ -115,7 +115,7 @@ def get_next_submission(request, course_id): ...@@ -115,7 +115,7 @@ def get_next_submission(request, course_id):
p = request.POST p = request.POST
location = p['location'] location = p['location']
return HttpResponse(_get_next(course_id, request.user.id, location), return HttpResponse(_get_next_submission(course_id, request.user.id, location),
mimetype="application/json") mimetype="application/json")
def _get_next_submission(course_id, grader_id, location): def _get_next_submission(course_id, grader_id, location):
...@@ -144,7 +144,7 @@ def save_grade(request, course_id): ...@@ -144,7 +144,7 @@ def save_grade(request, course_id):
feedback = p['feedback'] feedback = p['feedback']
submission_key = p['submission_key'] submission_key = p['submission_key']
try: try:
response = peer_grading_service().save_grade(grader_id, submission_id, response = peer_grading_service().save_grade(location, grader_id, submission_id,
score, feedback, submission_key) score, feedback, submission_key)
return HttpResponse(response, mimetype="application/json") return HttpResponse(response, mimetype="application/json")
except GradingServiceError: except GradingServiceError:
......
...@@ -45,7 +45,6 @@ class PeerGradingProblemBackend ...@@ -45,7 +45,6 @@ class PeerGradingProblemBackend
response = response =
success: true success: true
return response return response
...@@ -101,9 +100,9 @@ class PeerGradingProblem ...@@ -101,9 +100,9 @@ class PeerGradingProblem
fetch_submission_essay: () => fetch_submission_essay: () =>
@backend.post('get_next_submission', {location: @location}, @render_submission) @backend.post('get_next_submission', {location: @location}, @render_submission)
construct_data: () => construct_data: () ->
data = data =
score: @score score: $('input[name="score-selection"]:checked').val()
location: @location location: @location
submission_id: @essay_id_input.val() submission_id: @essay_id_input.val()
submission_key: @submission_key_input.val() submission_key: @submission_key_input.val()
...@@ -254,7 +253,7 @@ class PeerGradingProblem ...@@ -254,7 +253,7 @@ class PeerGradingProblem
mock_backend = true mock_backend = false
ajax_url = $('.peer-grading').data('ajax_url') ajax_url = $('.peer-grading').data('ajax_url')
backend = new PeerGradingProblemBackend(ajax_url, mock_backend) backend = new PeerGradingProblemBackend(ajax_url, mock_backend)
$(document).ready(() -> new PeerGradingProblem(backend)) $(document).ready(() -> new PeerGradingProblem(backend))
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