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
f3772d15
Commit
f3772d15
authored
Sep 25, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add method to find courses that contain a particular module location
parent
4e2808db
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
+17
-2
cms/djangoapps/contentstore/views.py
+1
-1
common/lib/xmodule/xmodule/modulestore/__init__.py
+16
-1
No files found.
cms/djangoapps/contentstore/views.py
View file @
f3772d15
...
...
@@ -110,7 +110,7 @@ def edit_item(request):
lms_link
=
"{lms_base}/courses/{course_id}/jump_to/{location}"
.
format
(
lms_base
=
settings
.
LMS_BASE
,
# TODO: These will need to be changed to point to the particular instance of this problem in the particular course
course_id
=
[
course
.
id
for
course
in
modulestore
()
.
get_courses
()
if
course
.
location
.
org
==
item
.
location
.
org
and
course
.
location
.
course
==
item
.
location
.
course
][
0
]
,
course_id
=
modulestore
()
.
get_containing_courses
()[
0
]
.
id
,
location
=
item
.
location
,
)
else
:
...
...
common/lib/xmodule/xmodule/modulestore/__init__.py
View file @
f3772d15
...
...
@@ -338,7 +338,6 @@ class ModuleStore(object):
'''
raise
NotImplementedError
def
get_parent_locations
(
self
,
location
):
'''Find all locations that are the parents of this location. Needed
for path_to_location().
...
...
@@ -347,6 +346,22 @@ class ModuleStore(object):
'''
raise
NotImplementedError
def
get_containing_courses
(
self
,
location
):
'''
Returns the list of courses that contains the specified location
TODO (cpennington): This should really take a module instance id,
rather than a location
'''
courses
=
[
course
for
course
in
self
.
get_courses
()
if
course
.
location
.
org
==
location
.
org
and
course
.
location
.
course
==
location
.
course
]
return
courses
class
ModuleStoreBase
(
ModuleStore
):
'''
...
...
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