From eab0cbdd85c5cd901f2590cc460b652844d923cf Mon Sep 17 00:00:00 2001 From: Jonathan Piacenti Date: Fri, 3 Jul 2015 20:57:02 +0000 Subject: [PATCH] Better fix for open ended grading. --- lms/djangoapps/open_ended_grading/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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