Properly parse url for grading controller

This commit is contained in:
Vik Paruchuri
2013-01-22 10:43:08 -05:00
parent e6dd07a41e
commit 693337593e
3 changed files with 14 additions and 5 deletions

View File

@@ -24,6 +24,7 @@ from static_replace import replace_urls
from open_ended_grading.peer_grading_service import PeerGradingService
from open_ended_grading.staff_grading_service import StaffGradingService
from open_ended_grading.controller_query_service import ControllerQueryService
from open_ended_grading import open_ended_util
from student.models import unique_id_for_user
from models import StudentModule
import datetime
@@ -158,10 +159,8 @@ def _peer_grading(tab, user, course, active_page):
def _combined_open_ended_grading(tab, user, course, active_page):
if user.is_authenticated:
link = reverse('open_ended_problems', args=[course.id])
peer_grading_url = settings.PEER_GRADING_INTERFACE
split_url = peer_grading_url.split("/")
controller_url = "http://" + split_url[2] + "/grading_controller"
log.debug(controller_url)
controller_url = open_ended_util.get_controller_url()
controller_qs = ControllerQueryService(controller_url)
student_id = unique_id_for_user(user)
course_id = course.id

View File

@@ -0,0 +1,7 @@
from django.conf import settings
def get_controller_url():
peer_grading_url = settings.PEER_GRADING_INTERFACE
split_url = peer_grading_url.split("/")
controller_url = "http://" + split_url[2] + "/grading_controller"
return controller_url

View File

@@ -19,6 +19,8 @@ import json
from .staff_grading import StaffGrading
from student.models import unique_id_for_user
import open_ended_util
log = logging.getLogger(__name__)
@@ -28,7 +30,8 @@ if settings.MOCK_PEER_GRADING:
else:
peer_gs = PeerGradingService(settings.PEER_GRADING_INTERFACE)
controller_qs = ControllerQueryService(settings.PEER_GRADING_INTERFACE)
controller_url = open_ended_util.get_controller_url()
controller_qs = ControllerQueryService(controller_url)
"""
Reverses the URL from the name and the course id, and then adds a trailing slash if