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
a9697556
Commit
a9697556
authored
Jan 09, 2015
by
Don Mitchell
Committed by
Adam Palay
Jan 09, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle children pointers to non-existent children in has_changes
TNL-1141
parent
592665cc
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
+3
-0
common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py
+3
-1
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
+7
-2
No files found.
common/lib/xmodule/xmodule/modulestore/mongo/draft.py
View file @
a9697556
...
...
@@ -624,6 +624,9 @@ class DraftModuleStore(MongoModuleStore):
return
True
# if this block doesn't have changes, then check its children
elif
xblock
.
has_children
:
# fix a bug where dangling pointers should imply a change
if
len
(
xblock
.
children
)
>
len
(
xblock
.
get_children
()):
return
True
return
any
([
self
.
has_changes
(
child
)
for
child
in
xblock
.
get_children
()])
# otherwise there are no changes
else
:
...
...
common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py
View file @
a9697556
...
...
@@ -268,8 +268,10 @@ class DraftVersioningModuleStore(SplitMongoModuleStore, ModuleStoreDraftAndPubli
def
has_changes_subtree
(
block_key
):
draft_block
=
get_block
(
draft_course
,
block_key
)
if
draft_block
is
None
:
# temporary fix for bad pointers TNL-1141
return
True
published_block
=
get_block
(
published_course
,
block_key
)
if
not
published_block
:
if
published_block
is
None
:
return
True
# check if the draft has changed since the published was created
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
View file @
a9697556
...
...
@@ -663,13 +663,18 @@ class TestMixedModuleStore(CourseComparisonTest):
self
.
assertTrue
(
self
.
_has_changes
(
parent
.
location
))
self
.
assertTrue
(
self
.
_has_changes
(
child
.
location
))
@ddt.data
(
'draft'
,
'split'
)
def
test_has_changes_missing_child
(
self
,
default_ms
):
@ddt.data
(
*
itertools
.
product
(
(
'draft'
,
'split'
),
(
ModuleStoreEnum
.
Branch
.
draft_preferred
,
ModuleStoreEnum
.
Branch
.
published_only
)
))
@ddt.unpack
def
test_has_changes_missing_child
(
self
,
default_ms
,
default_branch
):
"""
Tests that has_changes() does not throw an exception when a child doesn't exist.
"""
self
.
initdb
(
default_ms
)
with
self
.
store
.
branch_setting
(
default_branch
,
self
.
course
.
id
):
# Create the parent and point it to a fake child
parent
=
self
.
store
.
create_item
(
self
.
user_id
,
...
...
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