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
91438613
Commit
91438613
authored
Jul 23, 2014
by
cahrens
Committed by
Ben McMorran
Jul 25, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add edit info to instantiated xblock in update_item
parent
bff7c589
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
1 deletions
+38
-1
common/lib/xmodule/xmodule/modulestore/mongo/base.py
+14
-1
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
+24
-0
No files found.
common/lib/xmodule/xmodule/modulestore/mongo/base.py
View file @
91438613
...
...
@@ -1013,7 +1013,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
location
=
course_key
.
make_usage_key
(
block_type
,
block_id
)
xblock
=
self
.
create_xmodule
(
location
,
**
kwargs
)
self
.
update_item
(
xblock
,
user_id
,
allow_not_found
=
True
)
xblock
=
self
.
update_item
(
xblock
,
user_id
,
allow_not_found
=
True
)
return
xblock
...
...
@@ -1127,6 +1127,19 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
}
self
.
_update_ancestors
(
xblock
.
scope_ids
.
usage_id
,
ancestor_payload
)
# update the edit info of the instantiated xblock
xblock
.
edited_on
=
now
xblock
.
edited_by
=
user_id
xblock
.
subtree_edited_on
=
now
xblock
.
subtree_edited_by
=
user_id
if
not
hasattr
(
xblock
,
'published_date'
):
xblock
.
published_date
=
None
if
not
hasattr
(
xblock
,
'published_by'
):
xblock
.
published_by
=
None
if
isPublish
:
xblock
.
published_date
=
now
xblock
.
published_by
=
user_id
# recompute (and update) the metadata inheritance tree which is cached
self
.
refresh_cached_metadata_inheritance_tree
(
xblock
.
scope_ids
.
usage_id
.
course_key
,
xblock
.
runtime
)
# fire signal that we've written to DB
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py
View file @
91438613
...
...
@@ -4,6 +4,8 @@ import ddt
from
importlib
import
import_module
from
collections
import
namedtuple
import
unittest
import
datetime
from
pytz
import
UTC
from
xmodule.tests
import
DATA_DIR
from
opaque_keys.edx.locations
import
Location
...
...
@@ -666,6 +668,28 @@ class TestMixedModuleStore(unittest.TestCase):
self
.
assertEqual
(
len
(
orphans
),
0
,
"unexpected orphans: {}"
.
format
(
orphans
))
@ddt.data
(
'draft'
,
'split'
)
def
test_create_item_populates_edited_info
(
self
,
default_ms
):
self
.
initdb
(
default_ms
)
block
=
self
.
store
.
create_item
(
self
.
user_id
,
self
.
course
.
location
.
version_agnostic
()
.
course_key
,
'problem'
)
self
.
assertEqual
(
self
.
user_id
,
block
.
edited_by
)
self
.
assertGreater
(
datetime
.
datetime
.
now
(
UTC
),
block
.
edited_on
)
@ddt.data
(
'draft'
)
def
test_create_item_populates_subtree_edited_info
(
self
,
default_ms
):
self
.
initdb
(
default_ms
)
block
=
self
.
store
.
create_item
(
self
.
user_id
,
self
.
course
.
location
.
version_agnostic
()
.
course_key
,
'problem'
)
self
.
assertEqual
(
self
.
user_id
,
block
.
subtree_edited_by
)
self
.
assertGreater
(
datetime
.
datetime
.
now
(
UTC
),
block
.
subtree_edited_on
)
@ddt.data
(
'draft'
,
'split'
)
def
test_get_courses_for_wiki
(
self
,
default_ms
):
"""
Test the get_courses_for_wiki method
...
...
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