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
934d4e8a
Commit
934d4e8a
authored
Aug 07, 2014
by
Nimisha Asthagiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Split Course work with new Publishing UI.
parent
f10bcc1e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
common/lib/xmodule/xmodule/modulestore/split_mongo/caching_descriptor_system.py
+2
-0
common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py
+15
-15
No files found.
common/lib/xmodule/xmodule/modulestore/split_mongo/caching_descriptor_system.py
View file @
934d4e8a
...
...
@@ -152,6 +152,8 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
edit_info
=
json_data
.
get
(
'edit_info'
,
{})
module
.
edited_by
=
edit_info
.
get
(
'edited_by'
)
module
.
edited_on
=
edit_info
.
get
(
'edited_on'
)
module
.
subtree_edited_by
=
None
# TODO - addressed with LMS-11183
module
.
subtree_edited_on
=
None
# TODO - addressed with LMS-11183
module
.
published_by
=
None
# TODO - addressed with LMS-11184
module
.
published_date
=
None
# TODO - addressed with LMS-11184
module
.
previous_version
=
edit_info
.
get
(
'previous_version'
)
...
...
common/lib/xmodule/xmodule/modulestore/split_mongo/split_draft.py
View file @
934d4e8a
...
...
@@ -217,7 +217,7 @@ class DraftVersioningModuleStore(ModuleStoreDraftAndPublished, SplitMongoModuleS
return
True
# check if the draft has changed since the published was created
return
draft_block
[
'edit_info'
][
'update_version'
]
!=
published_block
[
'edit_info'
][
'source_version'
]
return
self
.
_get_version
(
draft_block
)
!=
self
.
_get_version
(
published_block
)
def
publish
(
self
,
location
,
user_id
,
blacklist
=
None
,
**
kwargs
):
...
...
@@ -266,24 +266,13 @@ class DraftVersioningModuleStore(ModuleStoreDraftAndPublished, SplitMongoModuleS
PublishState.public - published exists and is the same as draft
PublishState.private - no published version exists
"""
def
get_head
(
branch
):
course_structure
=
self
.
_lookup_course
(
xblock
.
location
.
course_key
.
for_branch
(
branch
))[
'structure'
]
return
self
.
_get_block_from_structure
(
course_structure
,
xblock
.
location
.
block_id
)
def
get_version
(
block
):
"""
Return the version of the given database representation of a block.
"""
#TODO: make this method a more generic helper
return
block
[
'edit_info'
]
.
get
(
'source_version'
,
block
[
'edit_info'
][
'update_version'
])
draft_head
=
get_head
(
ModuleStoreEnum
.
BranchName
.
draft
)
published_head
=
get_head
(
ModuleStoreEnum
.
BranchName
.
published
)
draft_head
=
self
.
_get_head
(
xblock
,
ModuleStoreEnum
.
BranchName
.
draft
)
published_head
=
self
.
_get_head
(
xblock
,
ModuleStoreEnum
.
BranchName
.
published
)
if
not
published_head
:
# published version does not exist
return
PublishState
.
private
elif
get_version
(
draft_head
)
==
get_version
(
published_head
):
elif
self
.
_get_version
(
draft_head
)
==
self
.
_
get_version
(
published_head
):
# published and draft versions are equal
return
PublishState
.
public
else
:
...
...
@@ -298,3 +287,14 @@ class DraftVersioningModuleStore(ModuleStoreDraftAndPublished, SplitMongoModuleS
"""
# This is a no-op in Split since a draft version of the data always remains
pass
def
_get_head
(
self
,
xblock
,
branch
):
course_structure
=
self
.
_lookup_course
(
xblock
.
location
.
course_key
.
for_branch
(
branch
))[
'structure'
]
return
self
.
_get_block_from_structure
(
course_structure
,
xblock
.
location
.
block_id
)
def
_get_version
(
self
,
block
):
"""
Return the version of the given database representation of a block.
"""
return
block
[
'edit_info'
]
.
get
(
'source_version'
,
block
[
'edit_info'
][
'update_version'
])
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