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
83ae677b
Commit
83ae677b
authored
Jul 24, 2017
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't add groups in experiment configurations twice.
EDUCATOR-947
parent
27cd3d19
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
12 deletions
+18
-12
cms/djangoapps/contentstore/views/course.py
+16
-11
cms/djangoapps/contentstore/views/tests/test_group_configurations.py
+2
-1
No files found.
cms/djangoapps/contentstore/views/course.py
View file @
83ae677b
...
...
@@ -1547,22 +1547,27 @@ def group_configurations_list_handler(request, course_key_string):
all_partitions
=
GroupConfiguration
.
get_all_user_partition_details
(
store
,
course
)
should_show_enrollment_track
=
False
group_schemes
=
[]
has_content_groups
=
False
displayable_partitions
=
[]
for
partition
in
all_partitions
:
group_schemes
.
append
(
partition
[
'scheme'
])
if
partition
[
'scheme'
]
==
ENROLLMENT_SCHEME
:
enrollment_track_configuration
=
partition
should_show_enrollment_track
=
len
(
enrollment_track_configuration
[
'groups'
])
>
1
if
partition
[
'scheme'
]
==
COHORT_SCHEME
:
has_content_groups
=
True
displayable_partitions
.
append
(
partition
)
elif
partition
[
'scheme'
]
==
ENROLLMENT_SCHEME
:
should_show_enrollment_track
=
len
(
partition
[
'groups'
])
>
1
# Remove the enrollment track partition and add it to the front of the list if it should be shown.
all_partitions
.
remove
(
partition
)
# Add it to the front of the list if it should be shown.
if
should_show_enrollment_track
:
all_partitions
.
insert
(
0
,
partition
)
displayable_partitions
.
insert
(
0
,
partition
)
elif
partition
[
'scheme'
]
!=
RANDOM_SCHEME
:
# Experiment group configurations are handled explicitly above. We don't
# want to display their groups twice.
displayable_partitions
.
append
(
partition
)
# Add empty content group if there is no COHORT User Partition in the list.
# This will add ability to add new groups in the view.
if
COHORT_SCHEME
not
in
group_scheme
s
:
all
_partitions
.
append
(
GroupConfiguration
.
get_or_create_content_group
(
store
,
course
))
if
not
has_content_group
s
:
displayable
_partitions
.
append
(
GroupConfiguration
.
get_or_create_content_group
(
store
,
course
))
return
render_to_response
(
'group_configurations.html'
,
{
'context_course'
:
course
,
...
...
@@ -1570,7 +1575,7 @@ def group_configurations_list_handler(request, course_key_string):
'course_outline_url'
:
course_outline_url
,
'experiment_group_configurations'
:
experiment_group_configurations
,
'should_show_experiment_groups'
:
should_show_experiment_groups
,
'all_group_configurations'
:
all
_partitions
,
'all_group_configurations'
:
displayable
_partitions
,
'should_show_enrollment_track'
:
should_show_enrollment_track
})
elif
"application/json"
in
request
.
META
.
get
(
'HTTP_ACCEPT'
):
...
...
cms/djangoapps/contentstore/views/tests/test_group_configurations.py
View file @
83ae677b
...
...
@@ -250,6 +250,7 @@ class GroupConfigurationsListHandlerTestCase(CourseTestCase, GroupConfigurations
Basic check that the groups configuration page responds correctly.
"""
# This creates a random UserPartition.
self
.
course
.
user_partitions
=
[
UserPartition
(
0
,
'First name'
,
'First description'
,
[
Group
(
0
,
'Group A'
),
Group
(
1
,
'Group B'
),
Group
(
2
,
'Group C'
)]),
]
...
...
@@ -261,7 +262,7 @@ class GroupConfigurationsListHandlerTestCase(CourseTestCase, GroupConfigurations
response
=
self
.
client
.
get
(
self
.
_url
())
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'First name'
)
self
.
assertContains
(
response
,
'First name'
,
count
=
1
)
self
.
assertContains
(
response
,
'Group C'
)
self
.
assertContains
(
response
,
CONTENT_GROUP_CONFIGURATION_NAME
)
...
...
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