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
43789a92
Commit
43789a92
authored
Dec 04, 2013
by
Don Mitchell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed test to ensure deletion on publish
parent
7a4204b7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
+5
-4
common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py
+1
-1
No files found.
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
View file @
43789a92
...
@@ -1166,20 +1166,21 @@ class SplitMongoModuleStore(ModuleStoreWriteBase):
...
@@ -1166,20 +1166,21 @@ class SplitMongoModuleStore(ModuleStoreWriteBase):
if
not
all
(
parent
in
destination_blocks
for
parent
in
parents
):
if
not
all
(
parent
in
destination_blocks
for
parent
in
parents
):
raise
ItemNotFoundError
(
parents
)
raise
ItemNotFoundError
(
parents
)
for
parent_loc
in
parents
:
for
parent_loc
in
parents
:
orphans
.
u
nion
(
orphans
.
u
pdate
(
self
.
_sync_children
(
self
.
_sync_children
(
source_structure
[
'blocks'
][
parent_loc
],
source_structure
[
'blocks'
][
parent_loc
],
destination_blocks
[
parent_loc
],
destination_blocks
[
parent_loc
],
subtree_root
subtree_root
))
))
# update/create the subtree and its children in destination (skipping blacklist)
# update/create the subtree and its children in destination (skipping blacklist)
orphans
.
u
nion
(
orphans
.
u
pdate
(
self
.
_publish_subdag
(
self
.
_publish_subdag
(
user_id
,
subtree_root
,
source_structure
[
'blocks'
],
destination_blocks
,
blacklist
or
[]
user_id
,
subtree_root
,
source_structure
[
'blocks'
],
destination_blocks
,
blacklist
or
[]
)
)
)
)
# remove any remaining orphans
# remove any remaining orphans
for
orphan
in
orphans
:
for
orphan
in
orphans
:
# orphans will include moved as well as deleted xblocks. Only delete the deleted ones.
self
.
_delete_if_true_orphan
(
orphan
,
destination_structure
)
self
.
_delete_if_true_orphan
(
orphan
,
destination_structure
)
# update the db
# update the db
...
@@ -1610,7 +1611,7 @@ class SplitMongoModuleStore(ModuleStoreWriteBase):
...
@@ -1610,7 +1611,7 @@ class SplitMongoModuleStore(ModuleStoreWriteBase):
)
)
for
child
in
destination_block
[
'fields'
]
.
get
(
'children'
,
[]):
for
child
in
destination_block
[
'fields'
]
.
get
(
'children'
,
[]):
if
child
not
in
blacklist
:
if
child
not
in
blacklist
:
orphans
.
u
nion
(
self
.
_publish_subdag
(
user_id
,
child
,
source_blocks
,
destination_blocks
,
blacklist
))
orphans
.
u
pdate
(
self
.
_publish_subdag
(
user_id
,
child
,
source_blocks
,
destination_blocks
,
blacklist
))
destination_blocks
[
block_id
]
=
destination_block
destination_blocks
[
block_id
]
=
destination_block
return
orphans
return
orphans
...
@@ -1624,7 +1625,7 @@ class SplitMongoModuleStore(ModuleStoreWriteBase):
...
@@ -1624,7 +1625,7 @@ class SplitMongoModuleStore(ModuleStoreWriteBase):
def
_delete_if_true_orphan
(
self
,
orphan
,
structure
):
def
_delete_if_true_orphan
(
self
,
orphan
,
structure
):
"""
"""
Delete the orphan and any of its descendants which no longer have parents
Delete the orphan and any of its descendants which no longer have parents
.
"""
"""
if
not
self
.
_get_parents_from_structure
(
orphan
,
structure
):
if
not
self
.
_get_parents_from_structure
(
orphan
,
structure
):
for
child
in
structure
[
'blocks'
][
orphan
][
'fields'
]
.
get
(
'children'
,
[]):
for
child
in
structure
[
'blocks'
][
orphan
][
'fields'
]
.
get
(
'children'
,
[]):
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py
View file @
43789a92
...
@@ -1174,7 +1174,7 @@ class TestPublish(SplitModuleTest):
...
@@ -1174,7 +1174,7 @@ class TestPublish(SplitModuleTest):
modulestore
()
.
delete_item
(
self
.
_usage
(
source_course
,
"problem3_2"
),
self
.
user
)
modulestore
()
.
delete_item
(
self
.
_usage
(
source_course
,
"problem3_2"
),
self
.
user
)
modulestore
()
.
xblock_publish
(
self
.
user
,
source_course
,
dest_course
,
[
"head12345"
],
[
"chapter2"
])
modulestore
()
.
xblock_publish
(
self
.
user
,
source_course
,
dest_course
,
[
"head12345"
],
[
"chapter2"
])
expected
=
[
"head12345"
,
"chapter1"
,
"chapter3"
,
"problem1"
]
expected
=
[
"head12345"
,
"chapter1"
,
"chapter3"
,
"problem1"
]
self
.
_check_course
(
source_course
,
dest_course
,
expected
,
[
"chapter2"
])
self
.
_check_course
(
source_course
,
dest_course
,
expected
,
[
"chapter2"
,
"problem3_2"
])
def
_check_course
(
self
,
source_course_loc
,
dest_course_loc
,
expected_blocks
,
unexpected_blocks
):
def
_check_course
(
self
,
source_course_loc
,
dest_course_loc
,
expected_blocks
,
unexpected_blocks
):
"""
"""
...
...
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