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
1ebc3b31
Commit
1ebc3b31
authored
Feb 28, 2013
by
Christina Roberts
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1566 from MITx/fix/cdodge/optimize-metadata-tree-computation
Fix/cdodge/optimize metadata tree computation
parents
9429262c
8a7211da
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
9 deletions
+24
-9
cms/djangoapps/contentstore/utils.py
+5
-2
cms/djangoapps/contentstore/views.py
+2
-2
common/lib/xmodule/xmodule/modulestore/mongo.py
+17
-5
No files found.
cms/djangoapps/contentstore/utils.py
View file @
1ebc3b31
...
...
@@ -75,12 +75,15 @@ def get_course_for_item(location):
return
courses
[
0
]
def
get_lms_link_for_item
(
location
,
preview
=
False
):
def
get_lms_link_for_item
(
location
,
preview
=
False
,
course_id
=
None
):
if
course_id
is
None
:
course_id
=
get_course_id
(
location
)
if
settings
.
LMS_BASE
is
not
None
:
lms_link
=
"//{preview}{lms_base}/courses/{course_id}/jump_to/{location}"
.
format
(
preview
=
'preview.'
if
preview
else
''
,
lms_base
=
settings
.
LMS_BASE
,
course_id
=
get_course_id
(
location
)
,
course_id
=
course_id
,
location
=
Location
(
location
)
)
else
:
...
...
cms/djangoapps/contentstore/views.py
View file @
1ebc3b31
...
...
@@ -114,7 +114,7 @@ def index(request):
"""
List all courses available to the logged in user
"""
courses
=
modulestore
()
.
get_items
([
'i4x'
,
None
,
None
,
'course'
,
None
])
courses
=
modulestore
(
'direct'
)
.
get_items
([
'i4x'
,
None
,
None
,
'course'
,
None
])
# filter out courses that we don't have access too
def
course_filter
(
course
):
...
...
@@ -132,7 +132,7 @@ def index(request):
course
.
location
.
org
,
course
.
location
.
course
,
course
.
location
.
name
]),
get_lms_link_for_item
(
course
.
location
))
get_lms_link_for_item
(
course
.
location
,
course_id
=
course
.
location
.
course_id
))
for
course
in
courses
],
'user'
:
request
.
user
,
'disable_course_creation'
:
settings
.
MITX_FEATURES
.
get
(
'DISABLE_COURSE_CREATION'
,
False
)
and
not
request
.
user
.
is_staff
...
...
common/lib/xmodule/xmodule/modulestore/mongo.py
View file @
1ebc3b31
...
...
@@ -157,10 +157,15 @@ class MongoModuleStore(ModuleStoreBase):
'''
# get all collections in the course, this query should not return any leaf nodes
query
=
{
'_id.org'
:
location
.
org
,
'_id.course'
:
location
.
course
,
'_id.revision'
:
None
,
'definition.children'
:{
'$ne'
:
[]}
query
=
{
'_id.org'
:
location
.
org
,
'_id.course'
:
location
.
course
,
'$or'
:
[
{
"_id.category"
:
"course"
},
{
"_id.category"
:
"chapter"
},
{
"_id.category"
:
"sequential"
},
{
"_id.category"
:
"vertical"
}
]
}
# we just want the Location, children, and metadata
record_filter
=
{
'_id'
:
1
,
'definition.children'
:
1
,
'metadata'
:
1
}
...
...
@@ -279,6 +284,13 @@ class MongoModuleStore(ModuleStoreBase):
resource_fs
=
OSFS
(
root
)
metadata_inheritance_tree
=
None
# if we are loading a course object, there is no parent to inherit the metadata from
# so don't bother getting it
if
item
[
'location'
][
'category'
]
!=
'course'
:
metadata_inheritance_tree
=
self
.
get_cached_metadata_inheritance_tree
(
Location
(
item
[
'location'
]),
300
)
# TODO (cdodge): When the 'split module store' work has been completed, we should remove
# the 'metadata_inheritance_tree' parameter
system
=
CachingDescriptorSystem
(
...
...
@@ -288,7 +300,7 @@ class MongoModuleStore(ModuleStoreBase):
resource_fs
,
self
.
error_tracker
,
self
.
render_template
,
metadata_inheritance_tree
=
self
.
get_cached_metadata_inheritance_tree
(
Location
(
item
[
'location'
]),
60
)
metadata_inheritance_tree
=
metadata_inheritance_tree
)
return
system
.
load_item
(
item
[
'location'
])
...
...
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