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
d4c6f9fa
Commit
d4c6f9fa
authored
Mar 30, 2017
by
Mushtaq Ali
Committed by
GitHub
Mar 30, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14748 from edx/mushtaq/fix-group-id
Make matching group ID condition be more specific
parents
4ba0bfcd
6b9f853c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
10 deletions
+10
-10
cms/djangoapps/contentstore/utils.py
+7
-7
cms/djangoapps/contentstore/views/item.py
+3
-3
No files found.
cms/djangoapps/contentstore/utils.py
View file @
d4c6f9fa
...
...
@@ -283,20 +283,20 @@ def reverse_usage_url(handler_name, usage_key, kwargs=None):
return
reverse_url
(
handler_name
,
'usage_key_string'
,
usage_key
,
kwargs
)
def
get_
group_display_name
(
user_partitions
,
xblock_display_nam
e
):
def
get_
split_group_display_name
(
xblock
,
cours
e
):
"""
Get the group name if matching group xblock is found
.
Returns group name if an xblock is found in user partition groups that are suitable for the split_test module
.
Arguments:
user_partitions (Dict): Locator of source item
.
xblock_display_name (String): Display name of group xblock
.
xblock (XBlock): The courseware component
.
course (XBlock): The course descriptor
.
Returns:
group name (String): Group name of the matching group.
group name (String): Group name of the matching group
xblock
.
"""
for
user_partition
in
user_partitions
:
for
user_partition
in
get_user_partition_info
(
xblock
,
schemes
=
[
'random'
],
course
=
course
)
:
for
group
in
user_partition
[
'groups'
]:
if
str
(
group
[
'id'
])
in
xblock_display_name
:
if
'Group ID {group_id}'
.
format
(
group_id
=
group
[
'id'
])
==
xblock
.
display_name_with_default
:
return
group
[
'name'
]
...
...
cms/djangoapps/contentstore/views/item.py
View file @
d4c6f9fa
...
...
@@ -29,7 +29,7 @@ from cms.lib.xblock.authoring_mixin import VISIBILITY_VIEW
from
contentstore.utils
import
(
find_release_date_source
,
find_staff_lock_source
,
is_currently_visible_to_students
,
ancestor_has_staff_lock
,
has_children_visible_to_specific_content_groups
,
get_user_partition_info
,
get_group_display_name
,
get_user_partition_info
,
get_
split_
group_display_name
,
)
from
contentstore.views.helpers
import
is_unit
,
xblock_studio_url
,
xblock_primary_child_category
,
\
xblock_type_display_name
,
get_parent_xblock
,
create_xblock
,
usage_key_with_run
...
...
@@ -1125,7 +1125,6 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F
# a percent value out of 100, e.g. "58%" means "58/100".
pct_sign
=
_
(
'
%
'
))
user_partitions
=
get_user_partition_info
(
xblock
,
course
=
course
)
xblock_info
=
{
'id'
:
unicode
(
xblock
.
location
),
'display_name'
:
xblock
.
display_name_with_default
,
...
...
@@ -1136,9 +1135,10 @@ def create_xblock_info(xblock, data=None, metadata=None, include_ancestor_info=F
if
child_info
and
len
(
child_info
.
get
(
'children'
,
[]))
>
0
:
xblock_info
[
'child_info'
]
=
child_info
# Groups are labelled with their internal ids, rather than with the group name. Replace id with display name.
group_display_name
=
get_
group_display_name
(
user_partitions
,
xblock_info
[
'display_name'
]
)
group_display_name
=
get_
split_group_display_name
(
xblock
,
course
)
xblock_info
[
'display_name'
]
=
group_display_name
if
group_display_name
else
xblock_info
[
'display_name'
]
else
:
user_partitions
=
get_user_partition_info
(
xblock
,
course
=
course
)
xblock_info
.
update
({
'edited_on'
:
get_default_time_display
(
xblock
.
subtree_edited_on
)
if
xblock
.
subtree_edited_on
else
None
,
'published'
:
published
,
...
...
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