Commit 93eebdcd by Calen Pennington

Merge pull request #1709 from…

Merge pull request #1709 from MITx/fix/cdodge/dont-compute-inherited-metadata-on-course-loads-with-depth-zero

if we're loading a course module with depth = 0, then we don't need to f...
parents 4131f867 133bd767
...@@ -382,7 +382,7 @@ class MongoModuleStore(ModuleStoreBase): ...@@ -382,7 +382,7 @@ class MongoModuleStore(ModuleStoreBase):
return data return data
def _load_item(self, item, data_cache): def _load_item(self, item, data_cache, should_apply_metadata_inheritence=True):
""" """
Load an XModuleDescriptor from item, using the children stored in data_cache Load an XModuleDescriptor from item, using the children stored in data_cache
""" """
...@@ -394,6 +394,9 @@ class MongoModuleStore(ModuleStoreBase): ...@@ -394,6 +394,9 @@ class MongoModuleStore(ModuleStoreBase):
resource_fs = OSFS(root) resource_fs = OSFS(root)
metadata_inheritance_tree = None
if should_apply_metadata_inheritence:
metadata_inheritance_tree = self.get_cached_metadata_inheritance_tree(Location(item['location'])) metadata_inheritance_tree = self.get_cached_metadata_inheritance_tree(Location(item['location']))
# TODO (cdodge): When the 'split module store' work has been completed, we should remove # TODO (cdodge): When the 'split module store' work has been completed, we should remove
...@@ -416,7 +419,10 @@ class MongoModuleStore(ModuleStoreBase): ...@@ -416,7 +419,10 @@ class MongoModuleStore(ModuleStoreBase):
""" """
data_cache = self._cache_children(items, depth) data_cache = self._cache_children(items, depth)
return [self._load_item(item, data_cache) for item in items] # if we are loading a course object, if we're not prefetching children (depth != 0) then don't
# bother with the metadata inheritence
return [self._load_item(item, data_cache,
should_apply_metadata_inheritence=(item['location']['category'] != 'course' or depth != 0)) for item in items]
def get_courses(self): def get_courses(self):
''' '''
......
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