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
37cfed61
Commit
37cfed61
authored
Sep 30, 2014
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap get_item inside bulk_operations internally, to cache query for active versions
[LMS-11402]
parent
87558c2c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
+8
-7
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
+4
-4
No files found.
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
View file @
37cfed61
...
...
@@ -849,13 +849,14 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
# The supplied UsageKey is of the wrong type, so it can't possibly be stored in this modulestore.
raise
ItemNotFoundError
(
usage_key
)
course
=
self
.
_lookup_course
(
usage_key
.
course_key
)
items
=
self
.
_load_items
(
course
,
[
BlockKey
.
from_usage_key
(
usage_key
)],
depth
,
lazy
=
True
,
**
kwargs
)
if
len
(
items
)
==
0
:
raise
ItemNotFoundError
(
usage_key
)
elif
len
(
items
)
>
1
:
log
.
debug
(
"Found more than one item for '{}'"
.
format
(
usage_key
))
return
items
[
0
]
with
self
.
bulk_operations
(
usage_key
.
course_key
):
course
=
self
.
_lookup_course
(
usage_key
.
course_key
)
items
=
self
.
_load_items
(
course
,
[
BlockKey
.
from_usage_key
(
usage_key
)],
depth
,
lazy
=
True
,
**
kwargs
)
if
len
(
items
)
==
0
:
raise
ItemNotFoundError
(
usage_key
)
elif
len
(
items
)
>
1
:
log
.
debug
(
"Found more than one item for '{}'"
.
format
(
usage_key
))
return
items
[
0
]
def
get_items
(
self
,
course_locator
,
settings
=
None
,
content
=
None
,
qualifiers
=
None
,
**
kwargs
):
"""
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
View file @
37cfed61
...
...
@@ -321,9 +321,9 @@ class TestMixedModuleStore(CourseComparisonTest):
# problem: find draft item, find all items pertinent to inheritance computation
# non-existent problem: find draft, find published
# split:
# problem: active_versions, structure
, then active_versions again?
# problem: active_versions, structure
# non-existent problem: ditto
@ddt.data
((
'draft'
,
[
2
,
2
],
0
),
(
'split'
,
[
3
,
3
],
0
))
@ddt.data
((
'draft'
,
[
2
,
2
],
0
),
(
'split'
,
[
2
,
2
],
0
))
@ddt.unpack
def
test_get_item
(
self
,
default_ms
,
max_find
,
max_send
):
self
.
initdb
(
default_ms
)
...
...
@@ -817,8 +817,8 @@ class TestMixedModuleStore(CourseComparisonTest):
xml_store
.
create_course
(
"org"
,
"course"
,
"run"
,
self
.
user_id
)
# draft is 2: find out which ms owns course, get item
# split:
find out which ms owns course, active_versions, structure, definition (definition s/b unnecessary unless lazy is false
)
@ddt.data
((
'draft'
,
2
,
0
),
(
'split'
,
4
,
0
))
# split:
active_versions, structure, definition (to load course wiki string
)
@ddt.data
((
'draft'
,
2
,
0
),
(
'split'
,
3
,
0
))
@ddt.unpack
def
test_get_course
(
self
,
default_ms
,
max_find
,
max_send
):
"""
...
...
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