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
40f89473
Commit
40f89473
authored
Jul 29, 2015
by
Mushtaq Ali
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9100 from edx/mushtaq/tnl2593-fix-publish-automatically-after-deleting-unit
Autopublish when vertical is deleted
parents
69646900
edad392a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py
+3
-1
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
+22
-1
No files found.
common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py
View file @
40f89473
...
@@ -213,9 +213,11 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
...
@@ -213,9 +213,11 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
parent_loc
=
self
.
get_parent_location
(
branched_location
)
parent_loc
=
self
.
get_parent_location
(
branched_location
)
SplitMongoModuleStore
.
delete_item
(
self
,
branched_location
,
user_id
)
SplitMongoModuleStore
.
delete_item
(
self
,
branched_location
,
user_id
)
# publish parent w/o child if deleted element is direct only (not based on type of parent)
# publish parent w/o child if deleted element is direct only (not based on type of parent)
# publish vertical to behave more like the old mongo/draft modulestore - TNL-2593
if
(
if
(
branch
==
ModuleStoreEnum
.
BranchName
.
draft
and
branch
==
ModuleStoreEnum
.
BranchName
.
draft
and
branched_location
.
block_type
in
DIRECT_ONLY_CATEGORIES
and
parent_loc
branched_location
.
block_type
in
(
DIRECT_ONLY_CATEGORIES
+
[
'vertical'
])
and
parent_loc
):
):
# will publish if its not an orphan
# will publish if its not an orphan
self
.
publish
(
parent_loc
.
version_agnostic
(),
user_id
,
blacklist
=
EXCLUDE_ALL
,
**
kwargs
)
self
.
publish
(
parent_loc
.
version_agnostic
(),
user_id
,
blacklist
=
EXCLUDE_ALL
,
**
kwargs
)
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
View file @
40f89473
...
@@ -634,6 +634,27 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
...
@@ -634,6 +634,27 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
vertical
=
self
.
store
.
get_item
(
vertical
.
location
)
vertical
=
self
.
store
.
get_item
(
vertical
.
location
)
self
.
assertTrue
(
self
.
_has_changes
(
vertical
.
location
))
self
.
assertTrue
(
self
.
_has_changes
(
vertical
.
location
))
@ddt.data
(
'draft'
,
'split'
)
def
test_publish_automatically_after_delete_unit
(
self
,
default_ms
):
"""
Check that sequential publishes automatically after deleting a unit
"""
self
.
initdb
(
default_ms
)
test_course
=
self
.
store
.
create_course
(
'test_org'
,
'test_course'
,
'test_run'
,
self
.
user_id
)
# create sequential and vertical to test against
sequential
=
self
.
store
.
create_item
(
self
.
user_id
,
test_course
.
id
,
'sequential'
,
'test_sequential'
)
vertical
=
self
.
store
.
create_child
(
self
.
user_id
,
sequential
.
location
,
'vertical'
,
'test_vertical'
)
# publish sequential changes
self
.
store
.
publish
(
sequential
.
location
,
self
.
user_id
)
self
.
assertFalse
(
self
.
_has_changes
(
sequential
.
location
))
# delete vertical and check sequential has no changes
self
.
store
.
delete_item
(
vertical
.
location
,
self
.
user_id
)
self
.
assertFalse
(
self
.
_has_changes
(
sequential
.
location
))
def
setup_has_changes
(
self
,
default_ms
):
def
setup_has_changes
(
self
,
default_ms
):
"""
"""
Common set up for has_changes tests below.
Common set up for has_changes tests below.
...
@@ -854,7 +875,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
...
@@ -854,7 +875,7 @@ class TestMixedModuleStore(CommonMixedModuleStoreSetup):
# Split:
# Split:
# queries: active_versions, draft and published structures, definition (unnecessary)
# queries: active_versions, draft and published structures, definition (unnecessary)
# sends: update published (why?), draft, and active_versions
# sends: update published (why?), draft, and active_versions
@ddt.data
((
'draft'
,
9
,
2
),
(
'split'
,
2
,
2
))
@ddt.data
((
'draft'
,
9
,
2
),
(
'split'
,
4
,
3
))
@ddt.unpack
@ddt.unpack
def
test_delete_private_vertical
(
self
,
default_ms
,
max_find
,
max_send
):
def
test_delete_private_vertical
(
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