Commit eab0cbdd by Jonathan Piacenti

Better fix for open ended grading.

parent 405b266f
import logging import logging
from urllib import urlencode
from xmodule.modulestore import search from xmodule.modulestore import search
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
...@@ -33,6 +34,8 @@ def generate_problem_url(problem_url_parts, base_course_url): ...@@ -33,6 +34,8 @@ def generate_problem_url(problem_url_parts, base_course_url):
@param base_course_url: Base url of a given course @param base_course_url: Base url of a given course
@return: A path to the problem @return: A path to the problem
""" """
activate_block_id = problem_url_parts[-1]
problem_url_parts = problem_url_parts[0:-1]
problem_url = base_course_url + "/" problem_url = base_course_url + "/"
for i, part in enumerate(problem_url_parts): for i, part in enumerate(problem_url_parts):
if part is not None: if part is not None:
...@@ -43,7 +46,8 @@ def generate_problem_url(problem_url_parts, base_course_url): ...@@ -43,7 +46,8 @@ def generate_problem_url(problem_url_parts, base_course_url):
# This is placed between the course id and the rest of the url. # This is placed between the course id and the rest of the url.
if i == 1: if i == 1:
problem_url += "courseware/" problem_url += "courseware/"
problem_url += unicode(part) + "/" problem_url += part + "/"
problem_url += '?{}'.format(urlencode({'activate_block_id': unicode(activate_block_id)}))
return problem_url return problem_url
......
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