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
032ff1cd
Commit
032ff1cd
authored
Sep 15, 2014
by
Don Mitchell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5200 from edx/split/lms-11396
Updating active_versions should not send old and new
parents
bc952d48
043c08bf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py
+15
-6
No files found.
common/lib/xmodule/xmodule/modulestore/split_mongo/mongo_connection.py
View file @
032ff1cd
...
...
@@ -6,6 +6,9 @@ import pymongo
from
contracts
import
check
from
xmodule.exceptions
import
HeartbeatFailure
from
xmodule.modulestore.split_mongo
import
BlockKey
from
datetime
import
tzinfo
import
datetime
import
pytz
def
structure_from_mongo
(
structure
):
...
...
@@ -187,6 +190,7 @@ class MongoConnection(object):
"""
Create the course_index in the db
"""
course_index
[
'last_update'
]
=
datetime
.
datetime
.
now
(
pytz
.
utc
)
self
.
course_index
.
insert
(
course_index
)
def
update_course_index
(
self
,
course_index
,
from_index
=
None
):
...
...
@@ -196,15 +200,20 @@ class MongoConnection(object):
Arguments:
from_index: If set, only update an index if it matches the one specified in `from_index`.
"""
self
.
course_index
.
update
(
from_index
or
{
if
from_index
:
query
=
{
"_id"
:
from_index
[
"_id"
]}
# last_update not only tells us when this course was last updated but also helps
# prevent collisions
if
'last_update'
in
from_index
:
query
[
'last_update'
]
=
from_index
[
'last_update'
]
else
:
query
=
{
'org'
:
course_index
[
'org'
],
'course'
:
course_index
[
'course'
],
'run'
:
course_index
[
'run'
],
},
course_index
,
upsert
=
False
,
)
}
course_index
[
'last_update'
]
=
datetime
.
datetime
.
now
(
pytz
.
utc
)
self
.
course_index
.
update
(
query
,
course_index
,
upsert
=
False
,)
def
delete_course_index
(
self
,
course_index
):
"""
...
...
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