Commit 78696c62 by Vik Paruchuri

Work on open ended flagged problems

parent 5f538f07
......@@ -21,6 +21,8 @@ class ControllerQueryService(GradingService):
self.is_unique_url = self.url + '/is_name_unique/'
self.combined_notifications_url = self.url + '/combined_notifications/'
self.grading_status_list_url = self.url + '/get_grading_status_list/'
self.flagged_problem_list_url = self.url + '/get_flagged_problem_list/'
self.take_action_on_flags_url = self.url + '/take_action_on_flags/'
def check_if_name_is_unique(self, location, problem_id, course_id):
params = {
......@@ -57,3 +59,21 @@ class ControllerQueryService(GradingService):
response = self.get(self.grading_status_list_url, params)
return response
def get_flagged_problem_list(self, course_id):
params = {
'course_id' : course_id,
}
response = self.get(self.flagged_problem_list_url, params)
return response
def take_action_on_flags(self, course_id, student_id, submission_id):
params = {
'course_id' : course_id,
'student_id' : student_id,
'submission_id' : submission_id,
}
response = self.post(self.take_action_on_flags_url, params)
return response
......@@ -194,6 +194,61 @@ def student_problem_list(request, course_id):
'staff_access': False, })
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
def flagged_problem_list(request, course_id):
'''
Show a student problem list
'''
course = get_course_with_access(request.user, course_id, 'staff')
student_id = unique_id_for_user(request.user)
# call problem list service
success = False
error_text = ""
problem_list = []
base_course_url = reverse('courses')
try:
problem_list_json = controller_qs.get_grading_status_list(course_id, unique_id_for_user(request.user))
problem_list_dict = json.loads(problem_list_json)
success = problem_list_dict['success']
if 'error' in problem_list_dict:
error_text = problem_list_dict['error']
problem_list = problem_list_dict['problem_list']
for i in xrange(0,len(problem_list)):
problem_url_parts = search.path_to_location(modulestore(), course.id, problem_list[i]['location'])
problem_url = base_course_url + "/"
for z in xrange(0,len(problem_url_parts)):
part = problem_url_parts[z]
if part is not None:
if z==1:
problem_url += "courseware/"
problem_url += part + "/"
problem_list[i].update({'actual_url' : problem_url})
except GradingServiceError:
error_text = "Error occured while contacting the grading service"
success = False
# catch error if if the json loads fails
except ValueError:
error_text = "Could not get problem list"
success = False
ajax_url = _reverse_with_slash('open_ended_problems', course_id)
return render_to_response('open_ended_problems/open_ended_problems.html', {
'course': course,
'course_id': course_id,
'ajax_url': ajax_url,
'success': success,
'problem_list': problem_list,
'error_text': error_text,
# Checked above
'staff_access': False, })
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
def combined_notifications(request, course_id):
course = get_course_with_access(request.user, course_id, 'load')
user = request.user
......
<%inherit file="/main.html" />
<%block name="bodyclass">${course.css_class}</%block>
<%namespace name='static' file='/static_content.html'/>
<%block name="headextra">
<%static:css group='course'/>
</%block>
<%block name="title"><title>${course.number} Flagged Open Ended Problems</title></%block>
<%include file="/courseware/course_navigation.html" args="active_page='flagged_open_ended_problems'" />
<section class="container">
<div class="open-ended-problems" data-ajax_url="${ajax_url}">
<div class="error-container">${error_text}</div>
<h1>Flagged Open Ended Problems</h1>
<h2>Instructions</h2>
<p>Here are a list of open ended problems for this course that have been flagged by students as potentially inappropriate.</p>
% if success:
% if len(flagged_list) == 0:
<div class="message-container">
No flagged problems exist.
</div>
%else:
<table class="problem-list">
<tr>
<th>Problem Name</th>
<th>Student ID</th>
<th>Student Response</th>
<th>Submission ID</th>
</tr>
%for problem in problem_list:
<tr>
<td>
${problem['problem_name']}
</td>
<td>
${problem['student_id']}
</td>
<td>
${problem['student_response']}
</td>
<td>
${problem['submission_id']}
</td>
</tr>
%endfor
</table>
%endif
%endif
</div>
</section>
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