Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
484735bf
Commit
484735bf
authored
Aug 30, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make jump_to go to right position in a sequence.
parent
021ccde1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
common/lib/xmodule/xmodule/modulestore/search.py
+10
-4
No files found.
common/lib/xmodule/xmodule/modulestore/search.py
View file @
484735bf
...
...
@@ -26,7 +26,7 @@ def path_to_location(modulestore, course_id, location):
A location may be accessible via many paths. This method may
return any valid path.
If the section is a sequen
ce
, position will be the position
If the section is a sequen
tial or vertical
, position will be the position
of this location in that sequence. Otherwise, position will
be None. TODO (vshnayder): Not true yet.
'''
...
...
@@ -83,15 +83,21 @@ def path_to_location(modulestore, course_id, location):
path
=
find_path_to_course
()
if
path
is
None
:
raise
(
NoPathToItem
(
location
)
)
raise
NoPathToItem
(
location
)
n
=
len
(
path
)
course_id
=
CourseDescriptor
.
location_to_id
(
path
[
0
])
# pull out the location names
chapter
=
path
[
1
]
.
name
if
n
>
1
else
None
section
=
path
[
2
]
.
name
if
n
>
2
else
None
# TODO (vshnayder): not handling position at all yet...
# Figure out the position
position
=
None
if
n
>
3
:
section_desc
=
modulestore
.
get_instance
(
course_id
,
path
[
2
])
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
=
str
(
child_locs
.
index
(
path
[
3
])
+
1
)
return
(
course_id
,
chapter
,
section
,
position
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment