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
07c6b7cc
Commit
07c6b7cc
authored
Nov 30, 2015
by
Eric Fischer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10765 from edx/efischer/rc-patch-small
CohortMemberships minimal fix
parents
329beebe
12130c80
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
openedx/core/djangoapps/course_groups/models.py
+5
-0
No files found.
openedx/core/djangoapps/course_groups/models.py
View file @
07c6b7cc
...
...
@@ -98,9 +98,12 @@ class CohortMembership(models.Model):
success
=
False
for
__
in
range
(
max_retries
):
# This block will transactionally commit updates to CohortMembership and underlying course_user_groups.
with
transaction
.
atomic
():
try
:
# This block is atomic in order to make CohortMembership creation a small operation.
# It will commit the creation of the new CohortMembership, if needed.
with
transaction
.
atomic
():
saved_membership
,
created
=
CohortMembership
.
objects
.
select_for_update
()
.
get_or_create
(
user__id
=
self
.
user
.
id
,
...
...
@@ -123,9 +126,11 @@ class CohortMembership(models.Model):
self
.
previous_cohort_name
=
saved_membership
.
course_user_group
.
name
self
.
previous_cohort_id
=
saved_membership
.
course_user_group
.
id
self
.
previous_cohort
.
users
.
remove
(
self
.
user
)
self
.
previous_cohort
.
save
()
saved_membership
.
course_user_group
=
self
.
course_user_group
self
.
course_user_group
.
users
.
add
(
self
.
user
)
self
.
course_user_group
.
save
()
super
(
CohortMembership
,
saved_membership
)
.
save
(
update_fields
=
[
'course_user_group'
])
...
...
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