Commit 2191f3e2 by Vik Paruchuri

Add in open ended problems view

parent fe77bb00
...@@ -157,7 +157,7 @@ def _peer_grading(tab, user, course, active_page): ...@@ -157,7 +157,7 @@ def _peer_grading(tab, user, course, active_page):
def _combined_open_ended_grading(tab, user, course, active_page): def _combined_open_ended_grading(tab, user, course, active_page):
if user.is_authenticated: if user.is_authenticated:
link = reverse('peer_grading', args=[course.id]) link = reverse('open_ended_problems', args=[course.id])
peer_grading_url = settings.PEER_GRADING_INTERFACE peer_grading_url = settings.PEER_GRADING_INTERFACE
split_url = peer_grading_url.split("/") split_url = peer_grading_url.split("/")
controller_url = "http://" + split_url[2] + "/grading_controller" controller_url = "http://" + split_url[2] + "/grading_controller"
......
...@@ -13,6 +13,7 @@ from courseware.courses import get_course_with_access ...@@ -13,6 +13,7 @@ from courseware.courses import get_course_with_access
from peer_grading_service import PeerGradingService from peer_grading_service import PeerGradingService
from peer_grading_service import MockPeerGradingService from peer_grading_service import MockPeerGradingService
from controller_query_service import ControllerQueryService
from grading_service import GradingServiceError from grading_service import GradingServiceError
import json import json
from .staff_grading import StaffGrading from .staff_grading import StaffGrading
...@@ -26,6 +27,8 @@ if settings.MOCK_PEER_GRADING: ...@@ -26,6 +27,8 @@ if settings.MOCK_PEER_GRADING:
else: else:
peer_gs = PeerGradingService(settings.PEER_GRADING_INTERFACE) peer_gs = PeerGradingService(settings.PEER_GRADING_INTERFACE)
controller_qs = ControllerQueryService(settings.PEER_GRADING_INTERFACE)
""" """
Reverses the URL from the name and the course id, and then adds a trailing slash if Reverses the URL from the name and the course id, and then adds a trailing slash if
it does not exist yet it does not exist yet
...@@ -127,7 +130,7 @@ def student_problem_list(request, course_id, student_id): ...@@ -127,7 +130,7 @@ def student_problem_list(request, course_id, student_id):
error_text = "" error_text = ""
problem_list = [] problem_list = []
try: try:
problem_list_json = peer_gs.get_problem_list(course_id, unique_id_for_user(request.user)) 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) problem_list_dict = json.loads(problem_list_json)
success = problem_list_dict['success'] success = problem_list_dict['success']
if 'error' in problem_list_dict: if 'error' in problem_list_dict:
...@@ -143,9 +146,9 @@ def student_problem_list(request, course_id, student_id): ...@@ -143,9 +146,9 @@ def student_problem_list(request, course_id, student_id):
error_text = "Could not get problem list" error_text = "Could not get problem list"
success = False success = False
ajax_url = _reverse_with_slash('peer_grading', course_id) ajax_url = _reverse_with_slash('open_ended_problems', course_id)
return render_to_response('peer_grading/peer_grading.html', { return render_to_response('open_ended_problems/open_ended_problems.html', {
'course': course, 'course': course,
'course_id': course_id, 'course_id': course_id,
'ajax_url': ajax_url, 'ajax_url': ajax_url,
......
<%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} Open Ended Problems</title></%block>
<%include file="/courseware/course_navigation.html" args="active_page='open_ended_problems'" />
<section class="container">
<div class="open-ended-problems" data-ajax_url="${ajax_url}">
<div class="error-container">${error_text}</div>
<h1>Open Ended Problems</h1>
<h2>Instructions</h2>
<p>Here are a list of open ended problems for this course.</p>
% if success:
% if len(problem_list) == 0:
<div class="message-container">
You have not attempted any open ended problems yet.
</div>
%else:
<ul class="problem-list">
%for problem in problem_list:
<li>
<a href="${ajax_url}problem?location=${problem['location']}">${problem['problem_name']} (${problem['state']} , ${problem['grader_type']} )</a>
</li>
%endfor
</ul>
%endif
%endif
</div>
</section>
\ No newline at end of file
...@@ -282,7 +282,11 @@ if settings.COURSEWARE_ENABLED: ...@@ -282,7 +282,11 @@ if settings.COURSEWARE_ENABLED:
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/peer_grading/save_calibration_essay$', url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/peer_grading/save_calibration_essay$',
'open_ended_grading.peer_grading_service.save_calibration_essay', name='peer_grading_save_calibration_essay'), 'open_ended_grading.peer_grading_service.save_calibration_essay', name='peer_grading_save_calibration_essay'),
# Cohorts management # Open Ended problem list
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/open_ended_problems$',
'open_ended_grading.views.student_problem_list', name='open_ended_problems'),
# Cohorts management
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/cohorts$', url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/cohorts$',
'course_groups.views.list_cohorts', name="cohorts"), 'course_groups.views.list_cohorts', name="cohorts"),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/cohorts/add$', url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/cohorts/add$',
......
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