Commit 3710bd27 by Arjun Singh

Fixing sequentials nested inside of verticals, provides a path to sequentials…

Fixing sequentials nested inside of verticals, provides a path to sequentials nested in sequentials. Changes jump_to to redirect to courseware index.
parent d243c1d3
...@@ -93,11 +93,14 @@ def path_to_location(modulestore, course_id, location): ...@@ -93,11 +93,14 @@ def path_to_location(modulestore, course_id, location):
# Figure out the position # Figure out the position
position = None position = None
if n > 3: if n > 3:
section_desc = modulestore.get_instance(course_id, path[2]) position_list = []
child_locs = [c.location for c in section_desc.get_children()] for path_index in range(2, n-1):
# positions are 1-indexed, and should be strings to be consistent with if path[path_index].category == 'sequential':
# url parsing. section_desc = modulestore.get_instance(course_id, path[path_index])
position = str(child_locs.index(path[3]) + 1) child_locs = [c.location for c in section_desc.get_children()]
# positions are 1-indexed, and should be strings to be consistent with
# url parsing.
position_list.append(str(child_locs.index(path[path_index+1]) + 1))
position = "_".join(position_list)
return (course_id, chapter, section, position) return (course_id, chapter, section, position)
...@@ -218,8 +218,11 @@ def jump_to(request, course_id, location): ...@@ -218,8 +218,11 @@ def jump_to(request, course_id, location):
raise Http404("This location is not in any class: {0}".format(location)) raise Http404("This location is not in any class: {0}".format(location))
# Rely on index to do all error handling and access control. # Rely on index to do all error handling and access control.
return index(request, course_id, chapter, section, position) return redirect('courseware_position',
course_id=course_id,
chapter=chapter,
section=section,
position=position)
@ensure_csrf_cookie @ensure_csrf_cookie
def course_info(request, course_id): def course_info(request, course_id):
""" """
......
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