Commit b248a095 by Vik Paruchuri

Work on adding in ban actions

parent f89e36b5
......@@ -68,12 +68,14 @@ class ControllerQueryService(GradingService):
response = self.get(self.flagged_problem_list_url, params)
return response
def take_action_on_flags(self, course_id, student_id, submission_id):
def take_action_on_flags(self, course_id, student_id, submission_id, action_type):
params = {
'course_id' : course_id,
'student_id' : student_id,
'submission_id' : submission_id,
'action_type' : action_type
}
response = self.post(self.take_action_on_flags_url, params)
return response
......@@ -377,4 +377,4 @@ def save_calibration_essay(request, course_id):
return HttpResponse(response, mimetype="application/json")
except GradingServiceError:
log.exception("Error saving calibration grade, location: {0}, submission_id: {1}, submission_key: {2}, grader_id: {3}".format(location, submission_id, submission_key, grader_id))
return _err_response('Could not connect to grading service')
return _err_response('Could not connect to grading service')
\ No newline at end of file
......@@ -287,5 +287,32 @@ def combined_notifications(request, course_id):
return render_to_response('open_ended_problems/combined_notifications.html',
combined_dict
)
def take_action_on_flags(request, course_id):
"""
"""
if request.method != 'POST':
raise Http404
required = ['submission_id', 'action_type', 'student_id']
for key in required:
if key not in request.POST:
return HttpResponse(json.dumps({'success': False, 'error': 'Missing key {0}'.format(key)}),
mimetype="application/json")
p = request.POST
submission_id = p['submission_id']
action_type = p['action_type']
student_id = p['student_id']
try:
controller_qs = ControllerQueryService()
response = controller_qs.save_calibration_essay(course_id, student_id, course_id, action_type)
return HttpResponse(response, mimetype="application/json")
except GradingServiceError:
log.exception("Error saving calibration grade, location: {0}, submission_id: {1}, submission_key: {2}, grader_id: {3}".format(location, submission_id, submission_key, grader_id))
return _err_response('Could not connect to grading service')
......@@ -25,9 +25,9 @@
<table class="problem-list">
<tr>
<th>Name</th>
<th>Student ID</th>
<th>ID</th>
<th>Response</th>
<th>Unflag</th>
<th>Ban</th>
</tr>
%for problem in problem_list:
<tr>
......@@ -35,13 +35,19 @@
${problem['problem_name']}
</td>
<td>
${problem['student_id']}
${problem['student_response']}
</td>
<td>
${problem['submission_id']}
</td>
<td>
${problem['student_response']}
</td>
<td style="display:none;">
${problem['submission_id']}
</td>
<td style="display:none;">
${problem['student_id']}
</td>
</tr>
%endfor
......
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