Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
484735bf
Commit
484735bf
authored
12 years ago
by
Victor Shnayder
Browse files
Options
Downloads
Patches
Plain Diff
make jump_to go to right position in a sequence.
parent
021ccde1
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/lib/xmodule/xmodule/modulestore/search.py
+10
-4
10 additions, 4 deletions
common/lib/xmodule/xmodule/modulestore/search.py
with
10 additions
and
4 deletions
common/lib/xmodule/xmodule/modulestore/search.py
+
10
−
4
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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment