Skip to content

Commit

Permalink
fix: add support to Group Configuration view for Teams partitions (#3…
Browse files Browse the repository at this point in the history
  • Loading branch information
mariajgrimaldi authored May 6, 2024
1 parent 61b2870 commit b792222
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
7 changes: 7 additions & 0 deletions cms/djangoapps/contentstore/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from lti_consumer.models import CourseAllowPIISharingInLTIFlag
from opaque_keys.edx.keys import CourseKey, UsageKey
from opaque_keys.edx.locator import LibraryLocator
from openedx.core.lib.teams_config import CONTENT_GROUPS_FOR_TEAMS, TEAM_SCHEME
from openedx_events.content_authoring.data import DuplicatedXBlockData
from openedx_events.content_authoring.signals import XBLOCK_DUPLICATED
from openedx_events.learning.data import CourseNotificationData
Expand Down Expand Up @@ -2146,6 +2147,12 @@ def get_group_configurations_context(course, store):
# Add it to the front of the list if it should be shown.
if should_show_enrollment_track:
displayable_partitions.insert(0, partition)
elif partition['scheme'] == TEAM_SCHEME:
should_show_team_partitions = len(partition['groups']) > 0 and CONTENT_GROUPS_FOR_TEAMS.is_enabled(
course_key
)
if should_show_team_partitions:
displayable_partitions.append(partition)
elif partition['scheme'] != RANDOM_SCHEME:
# Experiment group configurations are handled explicitly above. We don't
# want to display their groups twice.
Expand Down
3 changes: 2 additions & 1 deletion cms/static/js/views/pages/group_configurations.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function($, _, gettext, BasePage, GroupConfigurationsListView, PartitionGroupLis
currentScheme = this.allGroupConfigurations[i].get('scheme');
this.allGroupViewList.push(
new PartitionGroupListView({
id: this.allGroupConfigurations[i].get('id'),
collection: this.allGroupConfigurations[i].get('groups'),
restrictEditing: this.allGroupConfigurations[i].get('read_only'),
scheme: currentScheme
Expand All @@ -43,7 +44,7 @@ function($, _, gettext, BasePage, GroupConfigurationsListView, PartitionGroupLis

// Render the remaining Configuration groups
for (i = 0; i < this.allGroupViewList.length; i++) {
currentClass = '.wrapper-groups.content-groups.' + this.allGroupViewList[i].scheme;
currentClass = `.wrapper-groups.content-groups.${this.allGroupViewList[i].scheme}.${this.allGroupViewList[i].id}`;
this.$(currentClass).append(this.allGroupViewList[i].render().el);
}

Expand Down
2 changes: 1 addition & 1 deletion cms/templates/group_configurations.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ <h1 class="page-header">
<article class="content-primary" role="main">

% for config in all_group_configurations:
<div class="wrapper-groups content-groups ${config['scheme']}">
<div class="wrapper-groups content-groups ${config['scheme']} ${config['id']}">
<h3 class="title">${config['name']}</h3>
<div class="ui-loading">
<p><span class="spin"><span class="icon fa fa-refresh" aria-hidden="true"></span></span> <span class="copy">${_("Loading")}</span></p>
Expand Down
2 changes: 2 additions & 0 deletions lms/djangoapps/teams/team_partition_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class TeamPartitionScheme:
- A user is assigned to a group if they are a member of the team.
"""

read_only = True

@classmethod
def get_group_for_user(cls, course_key, user, user_partition):
"""Get the (Content) Group from the specified user partition for the user.
Expand Down

0 comments on commit b792222

Please sign in to comment.