diff --git a/lms/djangoapps/open_ended_grading/utils.py b/lms/djangoapps/open_ended_grading/utils.py index b51ccc75ac..fac12a2cda 100644 --- a/lms/djangoapps/open_ended_grading/utils.py +++ b/lms/djangoapps/open_ended_grading/utils.py @@ -1,4 +1,5 @@ import logging +from urllib import urlencode from xmodule.modulestore import search from xmodule.modulestore.django import modulestore @@ -33,6 +34,8 @@ def generate_problem_url(problem_url_parts, base_course_url): @param base_course_url: Base url of a given course @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 + "/" for i, part in enumerate(problem_url_parts): if part is not None: @@ -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. if i == 1: problem_url += "courseware/" - problem_url += unicode(part) + "/" + problem_url += part + "/" + problem_url += '?{}'.format(urlencode({'activate_block_id': unicode(activate_block_id)})) return problem_url