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
5371d173
Commit
5371d173
authored
Dec 16, 2014
by
zubair-arbi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6246 from edx/zub/bugfix/plat-332-location-revison-error
fix location revision error for multi parent draft
parents
6b824897
99b86d7b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletions
+36
-1
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+1
-1
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
+35
-0
No files found.
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
5371d173
...
...
@@ -1306,7 +1306,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
ancestor_loc
=
parent_loc
while
ancestor_loc
is
not
None
:
current_loc
=
ancestor_loc
ancestor_loc
=
self
.
_get_raw_parent_location
(
current_loc
,
revision
)
ancestor_loc
=
self
.
_get_raw_parent_location
(
as_published
(
current_loc
)
,
revision
)
if
ancestor_loc
is
None
:
bulk_record
.
dirty
=
True
# The parent is an orphan, so remove all the children including
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
View file @
5371d173
...
...
@@ -979,6 +979,41 @@ class TestMixedModuleStore(CourseComparisonTest):
(
child_to_delete_location
,
None
,
ModuleStoreEnum
.
RevisionOption
.
published_only
),
])
@ddt.data
(
'draft'
)
def
test_get_parent_location_draft
(
self
,
default_ms
):
"""
Test that "get_parent_location" method returns first published parent
for a draft component, if it has many possible parents (including
draft parents).
"""
self
.
initdb
(
default_ms
)
course_id
=
self
.
course_locations
[
self
.
MONGO_COURSEID
]
.
course_key
# create parented children
self
.
_create_block_hierarchy
()
self
.
store
.
publish
(
self
.
course
.
location
,
self
.
user_id
)
mongo_store
=
self
.
store
.
_get_modulestore_for_courseid
(
course_id
)
# pylint: disable=protected-access
# add another parent (unit) "vertical_x1b" for problem "problem_x1a_1"
mongo_store
.
collection
.
update
(
self
.
vertical_x1b
.
to_deprecated_son
(
'_id.'
),
{
'$push'
:
{
'definition.children'
:
unicode
(
self
.
problem_x1a_1
)}}
)
# convert first parent (unit) "vertical_x1a" of problem "problem_x1a_1" to draft
self
.
store
.
convert_to_draft
(
self
.
vertical_x1a
,
self
.
user_id
)
item
=
self
.
store
.
get_item
(
self
.
vertical_x1a
)
self
.
assertTrue
(
self
.
store
.
has_published_version
(
item
))
# now problem "problem_x1a_1" has 3 parents [vertical_x1a (draft),
# vertical_x1a (published), vertical_x1b (published)]
# check that "get_parent_location" method of draft branch returns first
# published parent "vertical_x1a" without raising "AssertionError" for
# problem location revision
with
self
.
store
.
branch_setting
(
ModuleStoreEnum
.
Branch
.
draft_preferred
,
course_id
):
parent
=
mongo_store
.
get_parent_location
(
self
.
problem_x1a_1
)
self
.
assertEqual
(
parent
,
self
.
vertical_x1a
)
# Draft:
# Problem path:
# 1. Get problem
...
...
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