Skip to content
Snippets Groups Projects
Commit 8e9ec501 authored by Vik Paruchuri's avatar Vik Paruchuri
Browse files

Implement flagging, fix urls

parent 10c7155d
No related branches found
No related tags found
No related merge requests found
......@@ -226,7 +226,7 @@ def flagged_problem_list(request, course_id):
error_text = "Could not get problem list"
success = False
ajax_url = _reverse_with_slash('open_ended_problems', course_id)
ajax_url = _reverse_with_slash('open_ended_flagged_problems', course_id)
return render_to_response('open_ended_problems/open_ended_flagged_problems.html', {
'course': course,
......@@ -308,7 +308,6 @@ def take_action_on_flags(request, course_id):
student_id = p['student_id']
try:
controller_qs = ControllerQueryService()
response = controller_qs.take_action_on_flags(course_id, student_id, submission_id, action_type)
return HttpResponse(response, mimetype="application/json")
except GradingServiceError:
......
......@@ -24,13 +24,22 @@ class OpenEnded
ban: (event) =>
event.preventDefault()
@gentle_alert "Ban"
parent_tr = $(event.target).parent().parent()
tr_children = parent_tr.children()
action_type = "ban"
submission_id = tr_children[4].innerText
student_id = tr_children[5].innerText
@gentle_alert student_id
@post('take_action_on_flags', {'submission_id' : submission_id, 'student_id' : student_id, 'action_type' : action_type}, @handle_after_action)
post: (cmd, data, callback) ->
# if this post request fails, the error callback will catch it
$.post(@ajax_url + cmd, data, callback)
.error => callback({success: false, error: "Error occured while performing this operation"})
handle_after_action: (data) ->
@gentle_alert data
gentle_alert: (msg) =>
if $('.message-container').length
$('.message-container').remove()
......
......@@ -289,7 +289,7 @@ if settings.COURSEWARE_ENABLED:
# Open Ended flagged problem list
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/open_ended_flagged_problems$',
'open_ended_grading.views.flagged_problem_list', name='open_ended_flagged_problems'),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/open_ended_flagged_problems/take_action_on_flag$',
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/open_ended_flagged_problems/take_action_on_flags$',
'open_ended_grading.views.take_action_on_flags', name='open_ended_flagged_problems_take_action'),
# Cohorts management
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment