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
53d9f87d
Commit
53d9f87d
authored
Jul 25, 2017
by
Brandon Baker
Committed by
GitHub
Jul 25, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15662 from edx/bbaker/EDUCATOR-760
EDUCATOR-760
parents
f625e032
8e06cdbf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
3 deletions
+29
-3
cms/djangoapps/contentstore/tests/test_utils.py
+25
-0
cms/djangoapps/contentstore/utils.py
+4
-3
No files found.
cms/djangoapps/contentstore/tests/test_utils.py
View file @
53d9f87d
...
...
@@ -514,6 +514,31 @@ class GetUserPartitionInfoTest(ModuleStoreTestCase):
"deleted"
:
True
})
def
test_singular_deleted_group
(
self
):
"""
Verify that a partition with only one deleted group is
shown in the partition info with the group marked as deleted
"""
self
.
_set_partitions
([
UserPartition
(
id
=
0
,
name
=
"Cohort user partition"
,
scheme
=
UserPartition
.
get_scheme
(
"cohort"
),
description
=
"Cohorted user partition"
,
groups
=
[],
),
])
self
.
_set_group_access
({
0
:
[
1
]})
partitions
=
self
.
_get_partition_info
()
groups
=
partitions
[
0
][
"groups"
]
self
.
assertEqual
(
len
(
groups
),
1
)
self
.
assertEqual
(
groups
[
0
],
{
"id"
:
1
,
"name"
:
"Deleted Group"
,
"selected"
:
True
,
"deleted"
:
True
,
})
def
test_filter_by_partition_scheme
(
self
):
partitions
=
self
.
_get_partition_info
(
schemes
=
[
"random"
])
self
.
assertEqual
(
len
(
partitions
),
1
)
...
...
cms/djangoapps/contentstore/utils.py
View file @
53d9f87d
...
...
@@ -391,17 +391,18 @@ def get_user_partition_info(xblock, schemes=None, course=None):
for
p
in
sorted
(
get_all_partitions_for_course
(
course
,
active_only
=
True
),
key
=
lambda
p
:
p
.
name
):
# Exclude disabled partitions, partitions with no groups defined
# The exception to this case is when there is a selected group within that partition, which means there is
# a deleted group
# Also filter by scheme name if there's a filter defined.
if
p
.
groups
and
(
schemes
is
None
or
p
.
scheme
.
name
in
schemes
):
selected_groups
=
set
(
xblock
.
group_access
.
get
(
p
.
id
,
[])
or
[])
if
(
p
.
groups
or
selected_groups
)
and
(
schemes
is
None
or
p
.
scheme
.
name
in
schemes
):
# First, add groups defined by the partition
groups
=
[]
for
g
in
p
.
groups
:
# Falsey group access for a partition mean that all groups
# are selected. In the UI, though, we don't show the particular
# groups selected, since there's a separate option for "all users".
selected_groups
=
set
(
xblock
.
group_access
.
get
(
p
.
id
,
[])
or
[])
groups
.
append
({
"id"
:
g
.
id
,
"name"
:
g
.
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