Commit d0bbb0f6 by Chris Dodge

use a different query to get all collections. Also don't apply inheritance to…

use a different query to get all collections. Also don't apply inheritance to course modules, because that's ultimately a no-op
parent 1ed27209
...@@ -2,6 +2,7 @@ import pymongo ...@@ -2,6 +2,7 @@ import pymongo
import sys import sys
import logging import logging
import copy import copy
import time
from bson.son import SON from bson.son import SON
from fs.osfs import OSFS from fs.osfs import OSFS
...@@ -157,10 +158,15 @@ class MongoModuleStore(ModuleStoreBase): ...@@ -157,10 +158,15 @@ class MongoModuleStore(ModuleStoreBase):
''' '''
# get all collections in the course, this query should not return any leaf nodes # get all collections in the course, this query should not return any leaf nodes
query = { '_id.org' : location.org, query = {
'_id.course' : location.course, '_id.org': location.org,
'_id.revision' : None, '_id.course': location.course,
'definition.children':{'$ne': []} '$or': [
{"_id.category":"course"},
{"_id.category":"chapter"},
{"_id.category":"sequential"},
{"_id.category":"vertical"}
]
} }
# we just want the Location, children, and metadata # we just want the Location, children, and metadata
record_filter = {'_id':1,'definition.children':1,'metadata':1} record_filter = {'_id':1,'definition.children':1,'metadata':1}
...@@ -279,6 +285,13 @@ class MongoModuleStore(ModuleStoreBase): ...@@ -279,6 +285,13 @@ class MongoModuleStore(ModuleStoreBase):
resource_fs = OSFS(root) 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 # TODO (cdodge): When the 'split module store' work has been completed, we should remove
# the 'metadata_inheritance_tree' parameter # the 'metadata_inheritance_tree' parameter
system = CachingDescriptorSystem( system = CachingDescriptorSystem(
...@@ -288,7 +301,7 @@ class MongoModuleStore(ModuleStoreBase): ...@@ -288,7 +301,7 @@ class MongoModuleStore(ModuleStoreBase):
resource_fs, resource_fs,
self.error_tracker, self.error_tracker,
self.render_template, 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']) return system.load_item(item['location'])
......
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