Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, April 9th
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
43789a92
Commit
43789a92
authored
11 years ago
by
Don Mitchell
Browse files
Options
Downloads
Patches
Plain Diff
Fixed test to ensure deletion on publish
parent
7a4204b7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
+5
-4
5 additions, 4 deletions
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py
+1
-1
1 addition, 1 deletion
...odule/xmodule/modulestore/tests/test_split_modulestore.py
with
6 additions
and
5 deletions
common/lib/xmodule/xmodule/modulestore/split_mongo/split.py
+
5
−
4
View file @
43789a92
...
...
@@ -1166,20 +1166,21 @@ class SplitMongoModuleStore(ModuleStoreWriteBase):
if
not
all
(
parent
in
destination_blocks
for
parent
in
parents
):
raise
ItemNotFoundError
(
parents
)
for
parent_loc
in
parents
:
orphans
.
u
nion
(
orphans
.
u
pdate
(
self
.
_sync_children
(
source_structure
[
'
blocks
'
][
parent_loc
],
destination_blocks
[
parent_loc
],
subtree_root
))
# update/create the subtree and its children in destination (skipping blacklist)
orphans
.
u
nion
(
orphans
.
u
pdate
(
self
.
_publish_subdag
(
user_id
,
subtree_root
,
source_structure
[
'
blocks
'
],
destination_blocks
,
blacklist
or
[]
)
)
# remove any remaining 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
)
# update the db
...
...
@@ -1610,7 +1611,7 @@ class SplitMongoModuleStore(ModuleStoreWriteBase):
)
for
child
in
destination_block
[
'
fields
'
].
get
(
'
children
'
,
[]):
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
return
orphans
...
...
@@ -1624,7 +1625,7 @@ class SplitMongoModuleStore(ModuleStoreWriteBase):
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
):
for
child
in
structure
[
'
blocks
'
][
orphan
][
'
fields
'
].
get
(
'
children
'
,
[]):
...
...
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py
+
1
−
1
View file @
43789a92
...
...
@@ -1174,7 +1174,7 @@ class TestPublish(SplitModuleTest):
modulestore
().
delete_item
(
self
.
_usage
(
source_course
,
"
problem3_2
"
),
self
.
user
)
modulestore
().
xblock_publish
(
self
.
user
,
source_course
,
dest_course
,
[
"
head12345
"
],
[
"
chapter2
"
])
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
):
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment